Lustre fixes
cover Lustre fixes
These patches represent another round of Lustre fixes and also a few cleanups that some of the fixes were building up upon.
Please consider.
Alex Zhuravlev (1):
staging/lustre: LDLM_DEBUG() shouldn't be passed \n
Andriy Skulysh (1):
staging/lustre/osc: glimpse lock should match only with granted locks
Ben Evans (1):
staging/lustre/ptlrpc: Remove __ptlrpc_request_bufs_pack
Bob Glossman (1):
staging/lustre: Add newline to LU_OBJECT_DEBUG() message
Bruno Faccini (1):
staging/lustre/llite: lock i_lock before __d_drop()
Dmitry Eremin (1):
staging/lustre/osc: fix signed one bit field
Doug Oucharek (1):
staging/lustre/o2ib: Don't access NULL NI on failure path
Emoly Liu (1):
staging/lustre/llite: allocate and free client cache asynchronously
Jinshan Xiong (1):
staging/lustre/osc: osc_lock_weight endless loop fix
John L. Hammond (4):
staging/lustre/llite: correct request handling after ll_lookup_it() staging/lustre/llite: flatten struct lookup_intent staging/lustre/llite: change it_data to it_request staging/lustre/ldlm: const qualify struct lustre_handle * params
Liang Zhen (2):
staging/lustre/ptlrpc: reorganize ptlrpc_request staging/lustre/ptlrpc: missing wakeup for ptlrpc_check_set
Niu Yawei (1):
staging/lustre/mdc: Zero atime in close RPC
Oleg Drokin (6):
staging/lustre/llite: Get rid of ll_lock_dcache/ll_unlock_dcache staging/lustre/osc: Fix reverted condition in osc_lock_weight staging/lustre: Inline Lustre intent disposition functions staging/lustre/llite: Restore proper opencache operations staging/lustre/llite: ll_revalidate_dentry update staging/lustre: Add documentation for unstable_stats in sysfs
Patrick Farrell (1):
staging/lustre/llite: take trunc_sem only at vvp layer
Sergey Cheremencev (1):
staging/lustre/llite: don't panic when fid is insane
Vitaly Fertman (2):
staging/lustre/ptlrpc: Early Reply vs Reply MDunlink staging/lustre/ptlrpc: lost bulk leads to a hang
Yang Sheng (1):
staging/lustre/llite: ensure obd is effective in onu_upcall
akam kumar bharathi (1):
staging/lustre/llite: IOC_MDC_GETFILEINFO returns the wrong ino
.../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 8 +- drivers/staging/lustre/lustre/include/cl_object.h | 10 +- drivers/staging/lustre/lustre/include/lu_object.h | 2 +- drivers/staging/lustre/lustre/include/lustre_dlm.h | 18 +- .../staging/lustre/lustre/include/lustre_intent.h | 30 +- drivers/staging/lustre/lustre/include/lustre_mdc.h | 3 - drivers/staging/lustre/lustre/include/lustre_net.h | 414 ++++++++++++--------- drivers/staging/lustre/lustre/include/obd.h | 2 +- .../staging/lustre/lustre/include/obd_support.h | 3 + drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 16 +- drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 5 +- drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 6 +- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 2 +- drivers/staging/lustre/lustre/llite/dcache.c | 41 +- drivers/staging/lustre/lustre/llite/dir.c | 8 +- drivers/staging/lustre/lustre/llite/file.c | 66 ++-- drivers/staging/lustre/lustre/llite/lcommon_misc.c | 8 +- .../staging/lustre/lustre/llite/llite_internal.h | 27 +- drivers/staging/lustre/lustre/llite/llite_lib.c | 47 +-- drivers/staging/lustre/lustre/llite/llite_mmap.c | 7 - drivers/staging/lustre/lustre/llite/llite_nfs.c | 18 + drivers/staging/lustre/lustre/llite/lproc_llite.c | 6 +- drivers/staging/lustre/lustre/llite/namei.c | 25 +- drivers/staging/lustre/lustre/llite/statahead.c | 10 +- drivers/staging/lustre/lustre/llite/xattr_cache.c | 16 +- drivers/staging/lustre/lustre/lmv/lmv_intent.c | 26 +- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 8 +- drivers/staging/lustre/lustre/lov/lov_obd.c | 7 + drivers/staging/lustre/lustre/lov/lov_object.c | 4 +- drivers/staging/lustre/lustre/mdc/mdc_lib.c | 12 + drivers/staging/lustre/lustre/mdc/mdc_locks.c | 93 ++--- drivers/staging/lustre/lustre/mdc/mdc_request.c | 2 +- drivers/staging/lustre/lustre/obdclass/cl_page.c | 46 +++ drivers/staging/lustre/lustre/osc/osc_cache.c | 4 +- .../staging/lustre/lustre/osc/osc_cl_internal.h | 2 +- drivers/staging/lustre/lustre/osc/osc_lock.c | 18 +- drivers/staging/lustre/lustre/osc/osc_page.c | 4 +- drivers/staging/lustre/lustre/osc/osc_request.c | 12 +- drivers/staging/lustre/lustre/ptlrpc/client.c | 159 ++++---- drivers/staging/lustre/lustre/ptlrpc/events.c | 30 +- drivers/staging/lustre/lustre/ptlrpc/import.c | 3 +- drivers/staging/lustre/lustre/ptlrpc/niobuf.c | 20 +- .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 43 +++ drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 4 +- drivers/staging/lustre/lustre/ptlrpc/sec.c | 9 +- drivers/staging/lustre/sysfs-fs-lustre | 8 + 46 files changed, 777 insertions(+), 535 deletions(-)
Signature · 1 line
2.7.4
PATCH 1/28 staging/lustre/llite: allocate and free client cache asynchronously
From: Emoly Liu <[email protected]>
Since the inflight request holds import refcount as well as export, sometimes obd_disconnect() in client_common_put_super() can't put the last refcount of OSC import (e.g. due to network disconnection), this will cause cl_cache being accessed after free.
To fix this issue, ccc_users is used as cl_cache refcount, and lov/llite/osc all hold one cl_cache refcount respectively, to avoid the race that a new OST is being added into the system when the client is mounted.
The following cl_cache functions are added:
- cl_cache_init(): allocate and initialize cl_cache
- cl_cache_incref(): increase cl_cache refcount
- cl_cache_decref(): decrease cl_cache refcount and free the cache if refcount=0.
Reviewed-on: http://review.whamcloud.com/13746
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6173
--- drivers/staging/lustre/lustre/include/cl_object.h | 10 ++++- drivers/staging/lustre/lustre/include/obd.h | 2 +- .../staging/lustre/lustre/llite/llite_internal.h | 2 +- drivers/staging/lustre/lustre/llite/llite_lib.c | 35 +++++++--------- drivers/staging/lustre/lustre/llite/lproc_llite.c | 6 +-- drivers/staging/lustre/lustre/lov/lov_obd.c | 7 ++++ drivers/staging/lustre/lustre/obdclass/cl_page.c | 46 ++++++++++++++++++++++ drivers/staging/lustre/lustre/osc/osc_page.c | 4 +- drivers/staging/lustre/lustre/osc/osc_request.c | 4 +- 9 files changed, 86 insertions(+), 30 deletions(-)
drivers/staging/lustre/lustre/include/cl_object.h +9 -1
@@ -2322,7 +2322,8 @@ void cl_lock_descr_print(const struct lu_env *env, void *cookie,*/ struct cl_client_cache {/** -* # of users (OSCs) +* # of client cache refcount +* # of users (OSCs) + 2 (held by llite and lov) */ atomic_t ccc_users;/**
@@ -2357,6 +2358,13 @@ struct cl_client_cache { }; +/** +* cl_cache functions +*/ +struct cl_client_cache *cl_cache_init (unsigned long lru_page_max); +void cl_cache_incref (struct cl_client_cache *cache); +void cl_cache_decref (struct cl_client_cache *cache); +/** @} cl_page */ /** \defgroup cl_lock cl_lock
drivers/staging/lustre/lustre/include/obd.h +1 -1
@@ -415,7 +415,7 @@ struct lov_obd {enum lustre_sec_part lov_sp_me;/* Cached LRU and unstable data from upper layer */ -void *lov_cache; +struct cl_client_cache *lov_cache;struct rw_semaphore lov_notify_lock;
drivers/staging/lustre/lustre/llite/llite_internal.h +1 -1
@@ -493,7 +493,7 @@ struct ll_sb_info {* any page which is sent to a server as part of a bulk request, * but is uncommitted to stable storage. */ -struct cl_client_cache ll_cache; +struct cl_client_cache *ll_cache;struct lprocfs_stats *ll_ra_stats;
drivers/staging/lustre/lustre/llite/llite_lib.c +15 -20
@@ -83,15 +83,11 @@ static struct ll_sb_info *ll_init_sbi(struct super_block *sb) pages = si.totalram - si.totalhigh; lru_page_max = pages /2 ; -/* initialize ll_cache data */ -atomic_set (&sbi->ll_cache.ccc_users,0 ); - sbi->ll_cache.ccc_lru_max = lru_page_max; -atomic_set (&sbi->ll_cache.ccc_lru_left, lru_page_max); -spin_lock_init (&sbi->ll_cache.ccc_lru_lock); -INIT_LIST_HEAD (&sbi->ll_cache.ccc_lru); - -atomic_set (&sbi->ll_cache.ccc_unstable_nr,0 ); -init_waitqueue_head (&sbi->ll_cache.ccc_unstable_waitq); + sbi->ll_cache =cl_cache_init (lru_page_max); +if (!sbi->ll_cache) { +kfree (sbi); +return NULL ; + } sbi->ll_ra_info.ra_max_pages_per_file =min (pages /32 ,SBI_DEFAULT_READAHEAD_MAX );
@@ -131,6 +127,11 @@ static void ll_free_sbi(struct super_block *sb) {struct ll_sb_info *sbi =ll_s2sbi (sb); +if (sbi->ll_cache) { +cl_cache_decref (sbi->ll_cache); + sbi->ll_cache =NULL ; + } +kfree (sbi); }
@@ -514,8 +515,8 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,cl_sb_init (sb); err =obd_set_info_async (NULL , sbi->ll_dt_exp,sizeof (KEY_CACHE_SET ), -KEY_CACHE_SET ,sizeof (sbi->ll_cache), - &sbi->ll_cache,NULL ); +KEY_CACHE_SET ,sizeof (*sbi->ll_cache), + sbi->ll_cache,NULL ); sb->s_root =d_make_root (root);if (!sb->s_root) {
@@ -560,8 +561,6 @@ out_lock_cn_cb: out_dt:obd_disconnect (sbi->ll_dt_exp); sbi->ll_dt_exp =NULL ; -/* Make sure all OScs are gone, since cl_cache is accessing sbi. */ -obd_zombie_barrier (); out_md_fid:obd_fid_fini (sbi->ll_md_exp->exp_obd); out_md:
@@ -618,10 +617,6 @@ static void client_common_put_super(struct super_block *sb)obd_fid_fini (sbi->ll_dt_exp->exp_obd);obd_disconnect (sbi->ll_dt_exp); sbi->ll_dt_exp =NULL ; -/* wait till all OSCs are gone, since cl_cache is accessing sbi. -* see LU-2543. -*/ -obd_zombie_barrier ();ldebugfs_unregister_mountpoint (sbi);
@@ -962,12 +957,12 @@ void ll_put_super(struct super_block *sb)if (!force) {struct l_wait_info lwi =LWI_INTR (LWI_ON_SIGNAL_NOOP ,NULL ); - rc =l_wait_event (sbi->ll_cache.ccc_unstable_waitq, - !atomic_read (&sbi->ll_cache.ccc_unstable_nr), + rc =l_wait_event (sbi->ll_cache->ccc_unstable_waitq, + !atomic_read (&sbi->ll_cache->ccc_unstable_nr), &lwi); } - ccc_count =atomic_read (&sbi->ll_cache.ccc_unstable_nr); + ccc_count =atomic_read (&sbi->ll_cache->ccc_unstable_nr);if (!force && rc != -EINTR )LASSERTF (!ccc_count,"count: %i\n" , ccc_count);
drivers/staging/lustre/lustre/llite/lproc_llite.c +3 -3
@@ -360,7 +360,7 @@ static int ll_max_cached_mb_seq_show(struct seq_file *m, void *v) {struct super_block *sb = m->private;struct ll_sb_info *sbi =ll_s2sbi (sb); -struct cl_client_cache *cache = &sbi->ll_cache; +struct cl_client_cache *cache = sbi->ll_cache;int shift =20 -PAGE_SHIFT ;int max_cached_mb;int unused_mb;
@@ -387,7 +387,7 @@ static ssize_t ll_max_cached_mb_seq_write(struct file *file, {struct super_block *sb = ((struct seq_file *)file->private_data)->private;struct ll_sb_info *sbi =ll_s2sbi (sb); -struct cl_client_cache *cache = &sbi->ll_cache; +struct cl_client_cache *cache = sbi->ll_cache;struct lu_env *env;int refcheck;int mult, rc, pages_number;
@@ -826,7 +826,7 @@ static ssize_t unstable_stats_show(struct kobject *kobj, { struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info, ll_kobj); -struct cl_client_cache *cache = &sbi->ll_cache; +struct cl_client_cache *cache = sbi->ll_cache;int pages, mb; pages =atomic_read (&cache->ccc_unstable_nr);
drivers/staging/lustre/lustre/lov/lov_obd.c +7 -0
@@ -892,6 +892,12 @@ static int lov_cleanup(struct obd_device *obd)kfree (lov->lov_tgts); lov->lov_tgt_size =0 ; } + +if (lov->lov_cache) { +cl_cache_decref (lov->lov_cache); + lov->lov_cache =NULL ; + } +return 0 ; }
@@ -2121,6 +2127,7 @@ static int lov_set_info_async(const struct lu_env *env, struct obd_export *exp,LASSERT (!lov->lov_cache); lov->lov_cache = val; do_inactive =1 ; +cl_cache_incref (lov->lov_cache); }for (i =0 ; i < count; i++, val = (char *)val + incr) {
drivers/staging/lustre/lustre/obdclass/cl_page.c +46 -0
49 lines not on this page · raw message
drivers/staging/lustre/lustre/osc/osc_page.c +2 -2
@@ -414,7 +414,7 @@ static int osc_cache_too_much(struct client_obd *cli)int pages =atomic_read (&cli->cl_lru_in_list);unsigned long budget; - budget = cache->ccc_lru_max /atomic_read (&cache->ccc_users); + budget = cache->ccc_lru_max / (atomic_read (&cache->ccc_users) -2 );/* if it's going to run out LRU slots, we should free some, but not * too much to maintain fairness among OSCs.
@@ -714,7 +714,7 @@ int osc_lru_reclaim(struct client_obd *cli) cache->ccc_lru_shrinkers++;list_move_tail (&cli->cl_lru_osc, &cache->ccc_lru); - max_scans =atomic_read (&cache->ccc_users); + max_scans =atomic_read (&cache->ccc_users) -2 ;while (--max_scans >0 && !list_empty (&cache->ccc_lru)) { cli = list_entry(cache->ccc_lru.next, struct client_obd, cl_lru_osc);
drivers/staging/lustre/lustre/osc/osc_request.c +2 -2
@@ -2913,7 +2913,7 @@ static int osc_set_info_async(const struct lu_env *env, struct obd_export *exp,LASSERT (!cli->cl_cache);/* only once */ cli->cl_cache = val; -atomic_inc (&cli->cl_cache->ccc_users); +cl_cache_incref (cli->cl_cache); cli->cl_lru_left = &cli->cl_cache->ccc_lru_left;/* add this osc into entity list */
@@ -3293,7 +3293,7 @@ static int osc_cleanup(struct obd_device *obd)list_del_init (&cli->cl_lru_osc);spin_unlock (&cli->cl_cache->ccc_lru_lock); cli->cl_lru_left =NULL ; -atomic_dec (&cli->cl_cache->ccc_users); +cl_cache_decref (cli->cl_cache); cli->cl_cache =NULL ; }
Signature · 1 line
2.7.4
PATCH 2/28 staging/lustre/llite: correct request handling after ll_lookup_it()
In reply to Oleg DrokinFrom: "John L. Hammond" <[email protected]>
In the FIFO cases of ll_atomic_open() and ll_lookup_nd() remove spurious calls to ptlrpc_req_finished(). Explain that these cases are unreachable in practice anyway.
Reviewed-on: http://review.whamcloud.com/17068
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7402
--- drivers/staging/lustre/lustre/llite/namei.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/staging/lustre/lustre/llite/namei.c +3 -6
@@ -622,13 +622,10 @@ static int ll_atomic_open(struct inode *dir, struct dentry *dentry,if (d_really_is_positive (dentry) &&it_disposition (it,DISP_OPEN_OPEN )) {/* Open dentry. */ if (S_ISFIFO (d_inode (dentry)->i_mode)) { -/* We cannot call open here as it would -* deadlock. +/* We cannot call open here as it might +* deadlock. This case is unreachable in +* practice because of OBD_CONNECT_NODEVOH. */ -if (it_disposition (it,DISP_ENQ_OPEN_REF )) -ptlrpc_req_finished ( - (struct ptlrpc_request *) - it->d.lustre.it_data); rc =finish_no_open (file, de); }else { file->private_data = it;
Signature · 1 line
2.7.4
PATCH 3/28 staging/lustre/llite: Get rid of ll_lock_dcache/ll_unlock_dcache
In reply to Oleg DrokinThese are just doing spin_lock/unlock on inode's i_lock, so just do the spinlock directly to make the code more clear
--- drivers/staging/lustre/lustre/llite/dcache.c | 4 ++-- drivers/staging/lustre/lustre/llite/llite_internal.h | 10 ---------- drivers/staging/lustre/lustre/llite/namei.c | 8 ++++---- 3 files changed, 6 insertions(+), 16 deletions(-)
drivers/staging/lustre/lustre/llite/dcache.c +2 -2
@@ -249,7 +249,7 @@ void ll_invalidate_aliases(struct inode *inode)CDEBUG (D_INODE ,"marking dentries for ino " DFID "(%p) invalid\n" ,PFID (ll_inode2fid (inode)), inode); -ll_lock_dcache (inode); +spin_lock (&inode->i_lock);hlist_for_each_entry (dentry, &inode->i_dentry, d_u.d_alias) { CDEBUG(D_DENTRY, "dentry in drop %pd (%p) parent %p inode %p flags %d\n", dentry, dentry, dentry->d_parent,
@@ -257,7 +257,7 @@ void ll_invalidate_aliases(struct inode *inode)d_lustre_invalidate (dentry,0 ); } -ll_unlock_dcache (inode); +spin_unlock (&inode->i_lock); } int ll_revalidate_it_finish(struct ptlrpc_request *request,
drivers/staging/lustre/lustre/llite/llite_internal.h +0 -10
@@ -1313,16 +1313,6 @@ static inline void ll_set_lock_data(struct obd_export *exp, struct inode *inode, *bits = it->d.lustre.it_lock_bits; } -static inline void ll_lock_dcache (struct inode *inode) -{ -spin_lock (&inode->i_lock); -} - -static inline void ll_unlock_dcache (struct inode *inode) -{ -spin_unlock (&inode->i_lock); -} -static inline int d_lustre_invalid (const struct dentry *dentry) {struct ll_dentry_data *lld =ll_d2d (dentry);
drivers/staging/lustre/lustre/llite/namei.c +4 -4
@@ -140,7 +140,7 @@ static void ll_invalidate_negative_children(struct inode *dir) {struct dentry *dentry, *tmp_subdir; -ll_lock_dcache (dir); +spin_lock (&dir->i_lock);hlist_for_each_entry (dentry, &dir->i_dentry, d_u.d_alias) {spin_lock (&dentry->d_lock);if (!list_empty (&dentry->d_subdirs)) {
@@ -155,7 +155,7 @@ static void ll_invalidate_negative_children(struct inode *dir) }spin_unlock (&dentry->d_lock); } -ll_unlock_dcache (dir); +spin_unlock (&dir->i_lock); } int ll_md_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc,
@@ -317,7 +317,7 @@ static struct dentry *ll_find_alias(struct inode *inode, struct dentry *dentry) discon_alias =NULL ; invalid_alias =NULL ; -ll_lock_dcache (inode); +spin_lock (&inode->i_lock);hlist_for_each_entry (alias, &inode->i_dentry, d_u.d_alias) {LASSERT (alias != dentry);
@@ -342,7 +342,7 @@ static struct dentry *ll_find_alias(struct inode *inode, struct dentry *dentry)dget_dlock (alias);spin_unlock (&alias->d_lock); } -ll_unlock_dcache (inode); +spin_unlock (&inode->i_lock);return alias; }
Signature · 1 line
2.7.4
PATCH 4/28 staging/lustre/llite: lock i_lock before __d_drop()
In reply to Oleg DrokinFrom: Bruno Faccini <[email protected]>
There has been several Lustre Client crashes reported by sites running with Lustre versions 2.1/2.5, all showing the same dentry->d_hash->next corrupted pointer cause.
This patch fixes a regression that has been introduced since a long time by commit :
(LU-506 kernel: FC15 - support dcache scalability changes.)
where i_lock protection usage has been removed and that is likely to cause racy condition during dentry [un]hashing and to be the root cause of these crashes.
Reviewed-on: http://review.whamcloud.com/19287
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7973
--- drivers/staging/lustre/lustre/llite/file.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/staging/lustre/lustre/llite/file.c +4 -1
@@ -2975,8 +2975,11 @@ static int __ll_inode_revalidate(struct dentry *dentry, __u64 ibits)* here to preserve get_cwd functionality on 2.6. * Bug 10503 */ -if (!d_inode (dentry)->i_nlink) +if (!d_inode (dentry)->i_nlink) { +spin_lock (&inode->i_lock);d_lustre_invalidate (dentry,0 ); +spin_unlock (&inode->i_lock); + }ll_lookup_finish_locks (&oit, inode); }else if (!ll_have_md_lock (d_inode (dentry), &ibits,LCK_MINMODE )) {
Signature · 1 line
2.7.4
PATCH 5/28 staging/lustre/osc: osc_lock_weight endless loop fix
In reply to Oleg DrokinFrom: Jinshan Xiong <[email protected]>
With huge number of pages to scan by osc_lock_weight() it is likely CLP_GANG_RESCHED is returned from osc_page_gang_lookup() and the scan will be repeated again from the start. To be sure that the scan is progressing across those restarts, next scan should be started from the last scanned page index plus one.
Xyratex-bug-id: MRP-2145
Reviewed-on: http://review.whamcloud.com/12362
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5781
--- drivers/staging/lustre/lustre/osc/osc_lock.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/staging/lustre/lustre/osc/osc_lock.c +7 -7
@@ -634,11 +634,10 @@ static int weigh_cb(const struct lu_env *env, struct cl_io *io,if (cl_page_is_vmlocked (env, page) ||PageDirty (page->cp_vmpage) ||PageWriteback (page->cp_vmpage) - ) { - (*(unsigned long *)cbdata)++; + )return CLP_GANG_ABORT ; - } + *(pgoff_t *)cbdata =osc_index (ops) +1 ;return CLP_GANG_OKAY ; }
@@ -648,7 +647,7 @@ static unsigned long osc_lock_weight(const struct lu_env *env, {struct cl_io *io = &osc_env_info (env)->oti_io;struct cl_object *obj =cl_object_top (&oscobj->oo_cl); -unsigned long npages =0 ; +pgoff_t page_index;int result; io->ci_obj = obj;
@@ -657,11 +656,12 @@ static unsigned long osc_lock_weight(const struct lu_env *env,if (result !=0 )return result; + page_index =cl_index (obj, extent->start); do { result = osc_page_gang_lookup(env, io, oscobj, - cl_index(obj, extent->start), + page_index, cl_index(obj, extent->end), - weigh_cb, (void *)&npages); + weigh_cb, (void *)&page_index); if (result == CLP_GANG_ABORT) break; if (result == CLP_GANG_RESCHED)
@@ -669,7 +669,7 @@ static unsigned long osc_lock_weight(const struct lu_env *env, }while (result !=CLP_GANG_OKAY );cl_io_fini (env, io); -return npages; +return result ==CLP_GANG_ABORT ?1 :0 ; }/**
Signature · 1 line
2.7.4
PATCH 6/28 staging/lustre/osc: Fix reverted condition in osc_lock_weight
In reply to Oleg DrokinWhen importing clio simplification patch, the check for object got reversed by mistake when converting from
if (obj == NULL) it somehow became if (obj) which is obviously wrong, and so when it does hit, a crash was happening as result.
Fix the condition and all if fine now.
--- drivers/staging/lustre/lustre/osc/osc_lock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/osc/osc_lock.c +1 -1
@@ -699,7 +699,7 @@ unsigned long osc_ldlm_weigh_ast(struct ldlm_lock *dlmlock)LASSERT (dlmlock->l_resource->lr_type ==LDLM_EXTENT ); obj = dlmlock->l_ast_data; -if (obj) { +if (!obj) { weight =1 ; goto out; }
Signature · 1 line
2.7.4
PATCH 7/28 staging/lustre/ptlrpc: reorganize ptlrpc_request
In reply to Oleg DrokinFrom: Liang Zhen <[email protected]>
ptlrpc_request has some structure members are only for client side, and some others are only for server side, this patch moved these members to different structure then putting into an union.
By doing this, size of ptlrpc_request is decreased about 300 bytes, besides saving memory, it also can reduce memory footprint while processing.
Reviewed-on: http://review.whamcloud.com/8806
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-181
--- drivers/staging/lustre/lustre/include/lustre_net.h | 341 ++++++++++++--------- drivers/staging/lustre/lustre/ptlrpc/client.c | 49 +-- drivers/staging/lustre/lustre/ptlrpc/events.c | 5 +- drivers/staging/lustre/lustre/ptlrpc/niobuf.c | 2 +- .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 34 ++ drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 4 +- drivers/staging/lustre/lustre/ptlrpc/sec.c | 9 +- 7 files changed, 255 insertions(+), 189 deletions(-)
drivers/staging/lustre/lustre/include/lustre_net.h +202 -139
@@ -266,6 +266,11 @@/* Macro to hide a typecast. */ #define ptlrpc_req_async_args (req) ((void *)&req->rq_async_args) +struct ptlrpc_replay_async_args { +int praa_old_state; +int praa_old_status; +}; +/** * Structure to single define portal connection. */
@@ -1243,22 +1248,100 @@ struct ptlrpc_hpreq_ops {void (*hpreq_fini)(struct ptlrpc_request *); }; -/** -* Represents remote procedure call. -* -* This is a staple structure used by everybody wanting to send a request -* in Lustre. -*/ -struct ptlrpc_request { -/* Request type: one of PTL_RPC_MSG_* */ -int rq_type; -/** Result of request processing */ -int rq_status; +struct ptlrpc_cli_req { +/** For bulk requests on client only: bulk descriptor */ +struct ptlrpc_bulk_desc *cr_bulk; +/** optional time limit for send attempts */ +long cr_delay_limit; +/** time request was first queued */ +time_t cr_queued_time; +/** request sent timeval */ +struct timespec64 cr_sent_tv; +/** time for request really sent out */ +time_t cr_sent_out; +/** when req reply unlink must finish. */ +time_t cr_reply_deadline; +/** when req bulk unlink must finish. */ +time_t cr_bulk_deadline; +/** Portal to which this request would be sent */ +short cr_req_ptl; +/** Portal where to wait for reply and where reply would be sent */ +short cr_rep_ptl; +/** request resending number */ +unsigned int cr_resend_nr; +/** What was import generation when this request was sent */ +int cr_imp_gen; +enum lustre_imp_state cr_send_state; +/** Per-request waitq introduced by bug 21938 for recovery waiting */ +wait_queue_head_t cr_set_waitq; +/** Link item for request set lists */ +struct list_head cr_set_chain; +/** link to waited ctx */ +struct list_head cr_ctx_chain; + +/** client's half ctx */ +struct ptlrpc_cli_ctx *cr_cli_ctx; +/** Link back to the request set */ +struct ptlrpc_request_set *cr_set; +/** outgoing request MD handle */ +lnet_handle_md_t cr_req_md_h; +/** request-out callback parameter */ +struct ptlrpc_cb_id cr_req_cbid; +/** incoming reply MD handle */ +lnet_handle_md_t cr_reply_md_h; +wait_queue_head_t cr_reply_waitq; +/** reply callback parameter */ +struct ptlrpc_cb_id cr_reply_cbid; +/** Async completion handler, called when reply is received */ +ptlrpc_interpterer_t cr_reply_interp; +/** Async completion context */ +union ptlrpc_async_args cr_async_args; +/** Opaq data for replay and commit callbacks. */ +void *cr_cb_data;/** -* Linkage item through which this request is included into -* sending/delayed lists on client and into rqbd list on server +* Commit callback, called when request is committed and about to be +* freed. */ -struct list_head rq_list; +void (*cr_commit_cb)(struct ptlrpc_request *); +/** Replay callback, called after request is replayed at recovery */ +void (*cr_replay_cb)(struct ptlrpc_request *); +}; + +/** client request member alias */ +/* NB: these alias should NOT be used by any new code, instead they should +* be removed step by step to avoid potential abuse +*/ +#define rq_bulk rq_cli.cr_bulk +#define rq_delay_limit rq_cli.cr_delay_limit +#define rq_queued_time rq_cli.cr_queued_time +#define rq_sent_tv rq_cli.cr_sent_tv +#define rq_real_sent rq_cli.cr_sent_out +#define rq_reply_deadline rq_cli.cr_reply_deadline +#define rq_bulk_deadline rq_cli.cr_bulk_deadline +#define rq_nr_resend rq_cli.cr_resend_nr +#define rq_request_portal rq_cli.cr_req_ptl +#define rq_reply_portal rq_cli.cr_rep_ptl +#define rq_import_generation rq_cli.cr_imp_gen +#define rq_send_state rq_cli.cr_send_state +#define rq_set_chain rq_cli.cr_set_chain +#define rq_ctx_chain rq_cli.cr_ctx_chain +#define rq_set rq_cli.cr_set +#define rq_set_waitq rq_cli.cr_set_waitq +#define rq_cli_ctx rq_cli.cr_cli_ctx +#define rq_req_md_h rq_cli.cr_req_md_h +#define rq_req_cbid rq_cli.cr_req_cbid +#define rq_reply_md_h rq_cli.cr_reply_md_h +#define rq_reply_waitq rq_cli.cr_reply_waitq +#define rq_reply_cbid rq_cli.cr_reply_cbid +#define rq_interpret_reply rq_cli.cr_reply_interp +#define rq_async_args rq_cli.cr_async_args +#define rq_cb_data rq_cli.cr_cb_data +#define rq_commit_cb rq_cli.cr_commit_cb +#define rq_replay_cb rq_cli.cr_replay_cb + +struct ptlrpc_srv_req { +/** initial thread servicing this request */ +struct ptlrpc_thread *sr_svc_thread;/** * Server side list of incoming unserved requests sorted by arrival * time. Traversed from time to time to notice about to expire
@@ -1266,27 +1349,81 @@ struct ptlrpc_request {* know server is alive and well, just very busy to service their * requests in time */ -struct list_head rq_timed_list; -/** server-side history, used for debugging purposes. */ -struct list_head rq_history_list; +struct list_head sr_timed_list;/** server-side per-export list */ -struct list_head rq_exp_list; -/** server-side hp handlers */ -struct ptlrpc_hpreq_ops *rq_ops; - -/** initial thread servicing this request */ -struct ptlrpc_thread *rq_svc_thread; - +struct list_head sr_exp_list; +/** server-side history, used for debuging purposes. */ +struct list_head sr_hist_list;/** history sequence # */ -__u64 rq_history_seq; +__u64 sr_hist_seq; +/** the index of service's srv_at_array into which request is linked */ +time_t sr_at_index; +/** authed uid */ +uid_t sr_auth_uid; +/** authed uid mapped to */ +uid_t sr_auth_mapped_uid; +/** RPC is generated from what part of Lustre */ +enum lustre_sec_part sr_sp_from; +/** request session context */ +struct lu_context sr_ses;/** \addtogroup nrs * @{ */ /** stub for NRS request */ -struct ptlrpc_nrs_request rq_nrq; +struct ptlrpc_nrs_request sr_nrq;/** @} nrs */ -/** the index of service's srv_at_array into which request is linked */ -u32 rq_at_index; +/** request arrival time */ +struct timespec64 sr_arrival_time; +/** server's half ctx */ +struct ptlrpc_svc_ctx *sr_svc_ctx; +/** (server side), pointed directly into req buffer */ +struct ptlrpc_user_desc *sr_user_desc; +/** separated reply state */ +struct ptlrpc_reply_state *sr_reply_state; +/** server-side hp handlers */ +struct ptlrpc_hpreq_ops *sr_ops; +/** incoming request buffer */ +struct ptlrpc_request_buffer_desc *sr_rqbd; +}; + +/** server request member alias */ +/* NB: these alias should NOT be used by any new code, instead they should +* be removed step by step to avoid potential abuse +*/ +#define rq_svc_thread rq_srv.sr_svc_thread +#define rq_timed_list rq_srv.sr_timed_list +#define rq_exp_list rq_srv.sr_exp_list +#define rq_history_list rq_srv.sr_hist_list +#define rq_history_seq rq_srv.sr_hist_seq +#define rq_at_index rq_srv.sr_at_index +#define rq_auth_uid rq_srv.sr_auth_uid +#define rq_auth_mapped_uid rq_srv.sr_auth_mapped_uid +#define rq_sp_from rq_srv.sr_sp_from +#define rq_session rq_srv.sr_ses +#define rq_nrq rq_srv.sr_nrq +#define rq_arrival_time rq_srv.sr_arrival_time +#define rq_reply_state rq_srv.sr_reply_state +#define rq_svc_ctx rq_srv.sr_svc_ctx +#define rq_user_desc rq_srv.sr_user_desc +#define rq_ops rq_srv.sr_ops +#define rq_rqbd rq_srv.sr_rqbd + +/** +* Represents remote procedure call. +* +* This is a staple structure used by everybody wanting to send a request +* in Lustre. +*/ +struct ptlrpc_request { +/* Request type: one of PTL_RPC_MSG_* */ +int rq_type; +/** Result of request processing */ +int rq_status; +/** +* Linkage item through which this request is included into +* sending/delayed lists on client and into rqbd list on server +*/ +struct list_head rq_list;/** Lock to protect request flags and some other important bits, like * rq_list */
@@ -1327,19 +1464,15 @@ struct ptlrpc_request {/* bulk request, sent to server, but uncommitted */ rq_unstable:1 ; -unsigned int rq_nr_resend; - -enum rq_phase rq_phase;/* one of RQ_PHASE_* */ -enum rq_phase rq_next_phase;/* one of RQ_PHASE_* to be used next */ -atomic_t rq_refcount;/* client-side refcount for SENT race, -* server-side refcount for multiple replies -*/ - -/** Portal to which this request would be sent */ -short rq_request_portal;/* XXX FIXME bug 249 */ -/** Portal where to wait for reply and where reply would be sent */ -short rq_reply_portal;/* XXX FIXME bug 249 */ - +/** one of RQ_PHASE_* */ +enum rq_phase rq_phase; +/** one of RQ_PHASE_* to be used next */ +enum rq_phase rq_next_phase; +/** +* client-side refcount for SENT race, server-side refcount +* for multiple replies +*/ +atomic_t rq_refcount;/** * client-side: * !rq_truncate : # reply bytes actually received,
@@ -1350,6 +1483,8 @@ struct ptlrpc_request {int rq_reqlen;/** Reply length */ int rq_replen; +/** Pool if request is from preallocated list */ +struct ptlrpc_request_pool *rq_pool;/** Request message - what client sent */ struct lustre_msg *rq_reqmsg;/** Reply message - server response */
@@ -1362,19 +1497,20 @@ struct ptlrpc_request {* List item to for replay list. Not yet committed requests get linked * there. * Also see \a rq_replay comment above. +* It's also link chain on obd_export::exp_req_replay_queue */ struct list_head rq_replay_list; - +/** non-shared members for client & server request*/ +union { +struct ptlrpc_cli_req rq_cli; +struct ptlrpc_srv_req rq_srv; + };/** * security and encryption data * @{ */ -struct ptlrpc_cli_ctx *rq_cli_ctx;/**< client's half ctx */ -struct ptlrpc_svc_ctx *rq_svc_ctx;/**< server's half ctx */ -struct list_head rq_ctx_chain;/**< link to waited ctx */ - -struct sptlrpc_flavor rq_flvr;/**< for client & server */ -enum lustre_sec_part rq_sp_from; +/** description of flavors for client & server */ +struct sptlrpc_flavor rq_flvr;/* client/server security flags */ unsigned int
@@ -1393,19 +1529,15 @@ struct ptlrpc_request { rq_pack_bulk:1, /* doesn't expect reply FIXME */ rq_no_reply:1, - rq_pill_init:1; /* pill initialized */ - -uid_t rq_auth_uid;/* authed uid */ -uid_t rq_auth_mapped_uid;/* authed uid mapped to */ - -/* (server side), pointed directly into req buffer */ -struct ptlrpc_user_desc *rq_user_desc; - -/* various buffer pointers */ -struct lustre_msg *rq_reqbuf;/* req wrapper */ -char *rq_repbuf;/* rep buffer */ -struct lustre_msg *rq_repdata;/* rep wrapper msg */ -struct lustre_msg *rq_clrbuf;/* only in priv mode */ + rq_pill_init:1, /* pill initialized */ + rq_srv_req:1; /* server request */ + +/** various buffer pointers */ +struct lustre_msg *rq_reqbuf;/**< req wrapper */ +char *rq_repbuf;/**< rep buffer */ +struct lustre_msg *rq_repdata;/**< rep wrapper msg */ +/** only in priv mode */ +struct lustre_msg *rq_clrbuf;int rq_reqbuf_len;/* req wrapper buf len */ int rq_reqdata_len;/* req wrapper msg len */ int rq_repbuf_len;/* rep buffer len */
@@ -1422,97 +1554,28 @@ struct ptlrpc_request {__u32 rq_req_swab_mask;__u32 rq_rep_swab_mask; -/** What was import generation when this request was sent */ -int rq_import_generation; -enum lustre_imp_state rq_send_state; -/** how many early replies (for stats) */ int rq_early_count; -/** client+server request */ -lnet_handle_md_t rq_req_md_h; -struct ptlrpc_cb_id rq_req_cbid; -/** optional time limit for send attempts */ -long rq_delay_limit; -/** time request was first queued */ -unsigned long rq_queued_time; - -/* server-side... */ -/** request arrival time */ -struct timespec64 rq_arrival_time; -/** separated reply state */ -struct ptlrpc_reply_state *rq_reply_state; -/** incoming request buffer */ -struct ptlrpc_request_buffer_desc *rq_rqbd; - -/** client-only incoming reply */ -lnet_handle_md_t rq_reply_md_h; -wait_queue_head_t rq_reply_waitq; -struct ptlrpc_cb_id rq_reply_cbid; - +/** Server-side, export on which request was received */ +struct obd_export *rq_export; +/** import where request is being sent */ +struct obd_import *rq_import;/** our LNet NID */ lnet_nid_t rq_self;/** Peer description (the other side) */ lnet_process_id_t rq_peer; -/** Server-side, export on which request was received */ -struct obd_export *rq_export; -/** Client side, import where request is being sent */ -struct obd_import *rq_import; - -/** Replay callback, called after request is replayed@recovery */ -void (*rq_replay_cb)(struct ptlrpc_request *);/** -* Commit callback, called when request is committed and about to be -* freed. +* service time estimate (secs) +* If the request is not served by this time, it is marked as timed out. */ -void (*rq_commit_cb)(struct ptlrpc_request *); -/** Opaq data for replay and commit callbacks. */ -void *rq_cb_data; - -/** For bulk requests on client only: bulk descriptor */ -struct ptlrpc_bulk_desc *rq_bulk; - -/** client outgoing req */ +int rq_timeout;/** * when request/reply sent (secs), or time when request should be sent */ time64_t rq_sent; -/** time for request really sent out */ -time64_t rq_real_sent; - -/** when request must finish. volatile -* so that servers' early reply updates to the deadline aren't -* kept in per-cpu cache -*/ -volatile time64_t rq_deadline; -/** when req reply unlink must finish. */ -time64_t rq_reply_deadline; -/** when req bulk unlink must finish. */ -time64_t rq_bulk_deadline; -/** -* service time estimate (secs) -* If the requestsis not served by this time, it is marked as timed out. -*/ -int rq_timeout; - -/** Multi-rpc bits */ -/** Per-request waitq introduced by bug 21938 for recovery waiting */ -wait_queue_head_t rq_set_waitq; -/** Link item for request set lists */ -struct list_head rq_set_chain; -/** Link back to the request set */ -struct ptlrpc_request_set *rq_set; -/** Async completion handler, called when reply is received */ -ptlrpc_interpterer_t rq_interpret_reply; -/** Async completion context */ -union ptlrpc_async_args rq_async_args; - -/** Pool if request is from preallocated list */ -struct ptlrpc_request_pool *rq_pool; - -struct lu_context rq_session; -struct lu_context rq_recov_session; - +/** when request must finish. */ +time64_t rq_deadline;/** request format description */ struct req_capsule rq_pill; };
drivers/staging/lustre/lustre/ptlrpc/client.c +11 -38
110 lines not on this page · raw message
drivers/staging/lustre/lustre/ptlrpc/events.c +1 -4
@@ -324,6 +324,7 @@ void request_in_callback(lnet_event_t *ev) } } +ptlrpc_srv_req_init (req);/* NB we ABSOLUTELY RELY on req being zeroed, so pointers are NULL, * flags are reset and scalars are zero. We only set the message * size to non-zero if this was a successful receive.
@@ -337,10 +338,6 @@ void request_in_callback(lnet_event_t *ev) req->rq_self = ev->target.nid; req->rq_rqbd = rqbd; req->rq_phase =RQ_PHASE_NEW ; -spin_lock_init (&req->rq_lock); -INIT_LIST_HEAD (&req->rq_timed_list); -INIT_LIST_HEAD (&req->rq_exp_list); -atomic_set (&req->rq_refcount,1 );if (ev->type ==LNET_EVENT_PUT )CDEBUG (D_INFO ,"incoming req@%p x%llu msgsize %u\n" , req, req->rq_xid, ev->mlength);
drivers/staging/lustre/lustre/ptlrpc/niobuf.c +1 -1
@@ -633,7 +633,7 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply)OBD_FAIL_TIMEOUT (OBD_FAIL_PTLRPC_DELAY_SEND , request->rq_timeout +5 ); -ktime_get_real_ts64 (&request->rq_arrival_time); +ktime_get_real_ts64 (&request->rq_sent_tv); request->rq_sent =ktime_get_real_seconds ();/* We give the server rq_timeout secs to process the req, and * add the network latency for our local timeout.
drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h +34 -0
@@ -288,4 +288,38 @@ static inline void ptlrpc_reqset_put(struct ptlrpc_request_set *set)if (atomic_dec_and_test (&set->set_refcount)) kfree(set); } + +/** initialise ptlrpc common fields */ +static inline void ptlrpc_req_comm_init (struct ptlrpc_request *req) +{ +spin_lock_init (&req->rq_lock); +atomic_set (&req->rq_refcount,1 ); +INIT_LIST_HEAD (&req->rq_list); +INIT_LIST_HEAD (&req->rq_replay_list); +} + +/** initialise client side ptlrpc request */ +static inline void ptlrpc_cli_req_init (struct ptlrpc_request *req) +{ +struct ptlrpc_cli_req *cr = &req->rq_cli; + +ptlrpc_req_comm_init (req); +INIT_LIST_HEAD (&cr->cr_set_chain); +INIT_LIST_HEAD (&cr->cr_ctx_chain); +init_waitqueue_head (&cr->cr_reply_waitq); +init_waitqueue_head (&cr->cr_set_waitq); +} + +/** initialise server side ptlrpc request */ +static inline void ptlrpc_srv_req_init (struct ptlrpc_request *req) +{ +struct ptlrpc_srv_req *sr = &req->rq_srv; + +ptlrpc_req_comm_init (req); + req->rq_srv_req =1 ; +INIT_LIST_HEAD (&sr->sr_exp_list); +INIT_LIST_HEAD (&sr->sr_timed_list); +INIT_LIST_HEAD (&sr->sr_hist_list); +} +#endif /* PTLRPC_INTERNAL_H */
drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c +2 -2
@@ -157,9 +157,9 @@ static int ptlrpcd_users;void ptlrpcd_wake (struct ptlrpc_request *req) { -struct ptlrpc_request_set *rq_set = req->rq_set; +struct ptlrpc_request_set *set = req->rq_set; -wake_up (&rq_set->set_waitq); +wake_up (&set->set_waitq); }EXPORT_SYMBOL (ptlrpcd_wake);
drivers/staging/lustre/lustre/ptlrpc/sec.c +4 -5
@@ -863,11 +863,9 @@ int sptlrpc_import_check_ctx(struct obd_import *imp)if (!req)return -ENOMEM ; -spin_lock_init (&req->rq_lock); +ptlrpc_cli_req_init (req);atomic_set (&req->rq_refcount,10000 ); -INIT_LIST_HEAD (&req->rq_ctx_chain); -init_waitqueue_head (&req->rq_reply_waitq); -init_waitqueue_head (&req->rq_set_waitq); + req->rq_import = imp; req->rq_flvr = sec->ps_flvr; req->rq_cli_ctx = ctx;
@@ -1047,6 +1045,8 @@ int sptlrpc_cli_unwrap_early_reply(struct ptlrpc_request *req,if (!early_req)return -ENOMEM ; +ptlrpc_cli_req_init (early_req); + early_size = req->rq_nob_received; early_bufsz =size_roundup_power2 (early_size); early_buf =libcfs_kvzalloc (early_bufsz,GFP_NOFS );
@@ -1095,7 +1095,6 @@ int sptlrpc_cli_unwrap_early_reply(struct ptlrpc_request *req,memcpy (early_buf, req->rq_repbuf, early_size);spin_unlock (&req->rq_lock); -spin_lock_init (&early_req->rq_lock); early_req->rq_cli_ctx =sptlrpc_cli_ctx_get (req->rq_cli_ctx); early_req->rq_flvr = req->rq_flvr; early_req->rq_repbuf = early_buf;
Signature · 1 line
2.7.4
PATCH 8/28 staging/lustre/ptlrpc: missing wakeup for ptlrpc_check_set
In reply to Oleg DrokinFrom: Liang Zhen <[email protected]>
This patch changes a few things:
- There is no guarantee that request_out_callback will happen before reply_in_callback, if a request got reply and unlinked reply buffer before request_out_callback is called, then the thread waiting on ptlrpc_request_set will miss wakeup event.
This may seriously impact performance of some IO workloads or result in RPC timeout
- To make code more easier to understand, this patch changes action-bits "rq_req_unlink" and "rq_reply_unlink" to status-bits "rq_req_unlinked" and "rq_reply_unlinked"
Reviewed-on: http://review.whamcloud.com/12158
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5696
--- drivers/staging/lustre/lustre/include/lustre_net.h | 27 +++++++++++++--------- drivers/staging/lustre/lustre/ptlrpc/client.c | 12 ++++------ drivers/staging/lustre/lustre/ptlrpc/events.c | 22 +++++++++++------- drivers/staging/lustre/lustre/ptlrpc/niobuf.c | 14 +++++------ .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 9 ++++++++ 5 files changed, 51 insertions(+), 33 deletions(-)
drivers/staging/lustre/lustre/include/lustre_net.h +16 -11
@@ -1428,7 +1428,7 @@ struct ptlrpc_request {* rq_list */ spinlock_t rq_lock; -/** client-side flags are serialized by rq_lock */ +/** client-side flags are serialized by rq_lock @{ */ unsigned int rq_intr:1, rq_replied:1, rq_err:1, rq_timedout:1, rq_resend:1, rq_restart:1,/**
@@ -1444,18 +1444,15 @@ struct ptlrpc_request { rq_no_resend:1, rq_waiting:1, rq_receiving_reply:1, rq_no_delay:1, rq_net_err:1, rq_wait_ctx:1, rq_early:1, - rq_req_unlink:1, rq_reply_unlink:1, + rq_req_unlinked:1, /* unlinked request buffer from lnet */ + rq_reply_unlinked:1, /* unlinked reply buffer from lnet */ rq_memalloc:1, /* req originated from "kswapd" */ - /* server-side flags */ - rq_packed_final:1, /* packed final reply */ - rq_hp:1, /* high priority RPC */ - rq_at_linked:1, /* link into service's srv_at_array */ - rq_reply_truncate:1, rq_committed:1, - /* whether the "rq_set" is a valid one */ + rq_reply_truncated:1, + /** whether the "rq_set" is a valid one */ rq_invalid_rqset:1, rq_generation_set:1, - /* do not resend request on -EINPROGRESS */ + /** do not resend request on -EINPROGRESS */ rq_no_retry_einprogress:1,/* allow the req to be sent if the import is in recovery * status
@@ -1463,6 +1460,14 @@ struct ptlrpc_request { rq_allow_replay:1 ,/* bulk request, sent to server, but uncommitted */ rq_unstable:1; +/** @} */ + +/** server-side flags @{ */ +unsigned int + rq_hp:1, /**< high priority RPC */ + rq_at_linked:1, /**< link into service's srv_at_array */ + rq_packed_final:1; /**< packed final reply */ +/** @} */ /** one of RQ_PHASE_* */ enum rq_phase rq_phase;
@@ -2785,8 +2790,8 @@ ptlrpc_client_recv_or_unlink(struct ptlrpc_request *req)spin_unlock (&req->rq_lock);return 1 ; } - rc = req->rq_receiving_reply; - rc = rc || req->rq_req_unlink || req->rq_reply_unlink; + rc = !req->rq_req_unlinked || !req->rq_reply_unlinked || + req->rq_receiving_reply;spin_unlock (&req->rq_lock);return rc; }
drivers/staging/lustre/lustre/ptlrpc/client.c +5 -7
@@ -1148,9 +1148,9 @@ static int after_reply(struct ptlrpc_request *req)LASSERT (obd);/* repbuf must be unlinked */ -LASSERT (!req->rq_receiving_reply && !req->rq_reply_unlink); +LASSERT (!req->rq_receiving_reply && req->rq_reply_unlinked); -if (req->rq_reply_truncate) { +if (req->rq_reply_truncated) {if (ptlrpc_no_resend (req)) {DEBUG_REQ (D_ERROR , req,"reply buffer overflow, expected: %d, actual size: %d" , req->rq_nob_received, req->rq_repbuf_len);
@@ -2342,9 +2342,10 @@ int ptlrpc_unregister_reply(struct ptlrpc_request *request, int async)LASSERT (rc == -ETIMEDOUT );DEBUG_REQ (D_WARNING , request, -"Unexpectedly long timeout rvcng=%d unlnk=%d/%d" , +"Unexpectedly long timeout receiving_reply=%d req_ulinked=%d reply_unlinked=%d" , request->rq_receiving_reply, - request->rq_req_unlink, request->rq_reply_unlink); + request->rq_req_unlinked, + request->rq_reply_unlinked); }return 0 ; }
@@ -3002,9 +3003,6 @@ void *ptlrpcd_alloc_work(struct obd_import *imp, req->rq_import =class_import_get (imp); req->rq_interpret_reply = work_interpreter;/* don't want reply */ - req->rq_receiving_reply =0 ; - req->rq_req_unlink =0 ; - req->rq_reply_unlink =0 ; req->rq_no_delay =1 ; req->rq_no_resend =1 ; req->rq_pill.rc_fmt = (void *)&worker_format;
drivers/staging/lustre/lustre/ptlrpc/events.c +14 -8
@@ -51,27 +51,33 @@ void request_out_callback(lnet_event_t *ev) {struct ptlrpc_cb_id *cbid = ev->md.user_ptr;struct ptlrpc_request *req = cbid->cbid_arg; +bool wakeup = false; -LASSERT (ev->type ==LNET_EVENT_SEND || - ev->type ==LNET_EVENT_UNLINK ); +LASSERT (ev->type ==LNET_EVENT_SEND || ev->type ==LNET_EVENT_UNLINK );LASSERT (ev->unlinked);DEBUG_REQ (D_NET , req,"type %d, status %d" , ev->type, ev->status);sptlrpc_request_out_callback (req); +spin_lock (&req->rq_lock); req->rq_real_sent =ktime_get_real_seconds (); -if (ev->unlinked) - req->rq_req_unlink =0 ; + req->rq_req_unlinked =1 ; +/* reply_in_callback happened before request_out_callback? */ +if (req->rq_reply_unlinked) + wakeup = true;if (ev->type ==LNET_EVENT_UNLINK || ev->status !=0 ) {/* Failed send: make it seem like the reply timed out, just * like failing sends in client.c does currently... */ - req->rq_net_err =1 ; -ptlrpc_client_wake_req (req); + wakeup = true; } + +if (wakeup) +ptlrpc_client_wake_req (req); +spin_unlock (&req->rq_lock);ptlrpc_req_finished (req);
@@ -100,7 +106,7 @@ void reply_in_callback(lnet_event_t *ev) req->rq_receiving_reply =0 ; req->rq_early =0 ;if (ev->unlinked) - req->rq_reply_unlink =0 ; + req->rq_reply_unlinked =1 ;if (ev->status) goto out_wake;
@@ -114,7 +120,7 @@ void reply_in_callback(lnet_event_t *ev)if (ev->mlength < ev->rlength) {CDEBUG (D_RPCTRACE ,"truncate req %p rpc %d - %d+%d\n" , req, req->rq_replen, ev->rlength, ev->offset); - req->rq_reply_truncate =1 ; + req->rq_reply_truncated =1 ; req->rq_replied =1 ; req->rq_status = -EOVERFLOW ; req->rq_nob_received = ev->rlength + ev->offset;
drivers/staging/lustre/lustre/ptlrpc/niobuf.c +7 -7
@@ -577,19 +577,18 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) }spin_lock (&request->rq_lock); -/* If the MD attach succeeds, there _will_ be a reply_in callback */ - request->rq_receiving_reply = !noreply; - request->rq_req_unlink =1 ;/* We are responsible for unlinking the reply buffer */ - request->rq_reply_unlink = !noreply; + request->rq_reply_unlinked = noreply; + request->rq_receiving_reply = !noreply;/* Clear any flags that may be present from previous sends. */ + request->rq_req_unlinked =0 ; request->rq_replied =0 ; request->rq_err =0 ; request->rq_timedout =0 ; request->rq_net_err =0 ; request->rq_resend =0 ; request->rq_restart =0 ; - request->rq_reply_truncate =0 ; + request->rq_reply_truncated =0 ;spin_unlock (&request->rq_lock);if (!noreply) {
@@ -604,7 +603,7 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) reply_md.user_ptr = &request->rq_reply_cbid; reply_md.eq_handle = ptlrpc_eq_h; -/* We must see the unlink callback to unset rq_reply_unlink, +/* We must see the unlink callback to set rq_reply_unlinked, * so we can't auto-unlink */ rc = LNetMDAttach(reply_me_h, reply_md, LNET_RETAIN,
@@ -651,9 +650,10 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) connection, request->rq_request_portal, request->rq_xid, 0); -if (rc ==0 ) +if (likely (rc ==0 )) goto out; + request->rq_req_unlinked =1 ;ptlrpc_req_finished (request);if (noreply) goto out;
drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h +9 -0
@@ -304,6 +304,15 @@ static inline void ptlrpc_cli_req_init(struct ptlrpc_request *req)struct ptlrpc_cli_req *cr = &req->rq_cli;ptlrpc_req_comm_init (req); + + req->rq_receiving_reply =0 ; + req->rq_req_unlinked =1 ; + req->rq_reply_unlinked =1 ; + + req->rq_receiving_reply =0 ; + req->rq_req_unlinked =1 ; + req->rq_reply_unlinked =1 ; +INIT_LIST_HEAD (&cr->cr_set_chain);INIT_LIST_HEAD (&cr->cr_ctx_chain);init_waitqueue_head (&cr->cr_reply_waitq);
Signature · 1 line
2.7.4
PATCH 9/28 staging/lustre/ptlrpc: Early Reply vs Reply MDunlink
In reply to Oleg DrokinFrom: Vitaly Fertman <[email protected]>
A race between unregister_reply & early reply.
When buffers are busy for the early transfer, they cannon be unlinked by unregister_reply, so the RPC gets into UNREGISTERING state. The coming reply_in_callback for the early RPC already has unlinked flag set due to previous mdunlink attempt, but we handle it properly only for UNILNK event, whereas this is PUT in this case.
Seagate-bug-id: MRP-3323
Reviewed-on: http://review.whamcloud.com/18934
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7434
--- drivers/staging/lustre/lustre/ptlrpc/events.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/lustre/lustre/ptlrpc/events.c +2 -1
@@ -137,7 +137,8 @@ void reply_in_callback(lnet_event_t *ev) req->rq_early_count++;/* number received, client side */ -if (req->rq_replied)/* already got the real reply */ +/* already got the real reply or buffers are already unlinked */ +if (req->rq_replied || req->rq_reply_unlinked ==1 ) goto out_wake; req->rq_early =1 ;
Signature · 1 line
2.7.4
PATCH 10/28 staging/lustre/ptlrpc: Remove __ptlrpc_request_bufs_pack
In reply to Oleg DrokinFrom: Ben Evans <[email protected]>
Combine __ptlrpc_request_bufs_pack into ptlrpc_request_bufs_pack because it was an unnecessary wrapper otherwise.
Reviewed-on: http://review.whamcloud.com/16765
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7269
--- drivers/staging/lustre/lustre/ptlrpc/client.c | 34 ++++++++++----------------- 1 file changed, 13 insertions(+), 21 deletions(-)
drivers/staging/lustre/lustre/ptlrpc/client.c +13 -21
@@ -583,14 +583,19 @@ static void __ptlrpc_free_req_to_pool(struct ptlrpc_request *request)spin_unlock (&pool->prp_lock); } -static int __ptlrpc_request_bufs_pack (struct ptlrpc_request *request, -__u32 version,int opcode, -int count,__u32 *lengths,char **bufs, -struct ptlrpc_cli_ctx *ctx) +int ptlrpc_request_bufs_pack (struct ptlrpc_request *request, +__u32 version,int opcode,char **bufs, +struct ptlrpc_cli_ctx *ctx) { -struct obd_import *imp = request->rq_import; +int count; +struct obd_import *imp; +__u32 *lengths;int rc; + count =req_capsule_filled_sizes (&request->rq_pill,RCL_CLIENT ); + imp = request->rq_import; + lengths = request->rq_pill.rc_area[RCL_CLIENT ]; +if (unlikely (ctx)) { request->rq_cli_ctx =sptlrpc_cli_ctx_get (ctx); }else {
@@ -598,15 +603,12 @@ static int __ptlrpc_request_bufs_pack(struct ptlrpc_request *request,if (rc) goto out_free; } -sptlrpc_req_set_flavor (request, opcode); rc =lustre_pack_request (request, imp->imp_msg_magic, count, lengths, bufs); -if (rc) { -LASSERT (!request->rq_pool); +if (rc) goto out_ctx; - }lustre_msg_add_version (request->rq_reqmsg, version); request->rq_send_state =LUSTRE_IMP_FULL ;
@@ -631,24 +633,14 @@ static int __ptlrpc_request_bufs_pack(struct ptlrpc_request *request,lustre_msg_set_opc (request->rq_reqmsg, opcode);return 0 ; + out_ctx: +LASSERT (!request->rq_pool);sptlrpc_cli_ctx_put (request->rq_cli_ctx,1 ); out_free:class_import_put (imp);return rc; } - -int ptlrpc_request_bufs_pack (struct ptlrpc_request *request, -__u32 version,int opcode,char **bufs, -struct ptlrpc_cli_ctx *ctx) -{ -int count; - - count =req_capsule_filled_sizes (&request->rq_pill,RCL_CLIENT ); -return __ptlrpc_request_bufs_pack (request, version, opcode, count, - request->rq_pill.rc_area[RCL_CLIENT ], - bufs, ctx); -}EXPORT_SYMBOL (ptlrpc_request_bufs_pack);/**
Signature · 1 line
2.7.4
PATCH 11/28 staging/lustre/ptlrpc: lost bulk leads to a hang
In reply to Oleg DrokinFrom: Vitaly Fertman <[email protected]>
The reverse order of request_out_callback() and reply_in_callback() puts the RPC into UNREGISTERING state, which is waiting for RPC & bulk md unlink, whereas only RPC md unlink has been called so far. If bulk is lost, even expired_set does not check for UNREGISTERING state.
The same for write if server returns an error.
This phase is ambiguous, split to UNREG_RPC and UNREG_BULK.
Seagate-bug-id: MRP-2953, MRP-3206
Reviewed-on: http://review.whamcloud.com/19953
--- drivers/staging/lustre/lustre/include/lustre_net.h | 48 +++++++++------- .../staging/lustre/lustre/include/obd_support.h | 3 + drivers/staging/lustre/lustre/ptlrpc/client.c | 64 +++++++++++++++++++--- drivers/staging/lustre/lustre/ptlrpc/import.c | 3 +- drivers/staging/lustre/lustre/ptlrpc/niobuf.c | 4 +- 5 files changed, 91 insertions(+), 31 deletions(-)
drivers/staging/lustre/lustre/include/lustre_net.h +29 -19
@@ -480,8 +480,9 @@ enum rq_phase {RQ_PHASE_BULK =0xebc0de02 ,RQ_PHASE_INTERPRET =0xebc0de03 ,RQ_PHASE_COMPLETE =0xebc0de04 , -RQ_PHASE_UNREGISTERING =0xebc0de05 , - RQ_PHASE_UNDEFINED = 0xebc0de06 +RQ_PHASE_UNREG_RPC =0xebc0de05 , +RQ_PHASE_UNREG_BULK =0xebc0de06 , + RQ_PHASE_UNDEFINED = 0xebc0de07 };/** Type of request interpreter call-back */
@@ -1263,6 +1264,8 @@ struct ptlrpc_cli_req {time_t cr_reply_deadline;/** when req bulk unlink must finish. */ time_t cr_bulk_deadline; +/** when req unlink must finish. */ +time_t cr_req_deadline;/** Portal to which this request would be sent */ short cr_req_ptl;/** Portal where to wait for reply and where reply would be sent */
@@ -1318,6 +1321,7 @@ struct ptlrpc_cli_req {#define rq_real_sent rq_cli.cr_sent_out#define rq_reply_deadline rq_cli.cr_reply_deadline#define rq_bulk_deadline rq_cli.cr_bulk_deadline +#define rq_req_deadline rq_cli.cr_req_deadline#define rq_nr_resend rq_cli.cr_resend_nr#define rq_request_portal rq_cli.cr_req_ptl#define rq_reply_portal rq_cli.cr_rep_ptl
@@ -1693,8 +1697,10 @@ ptlrpc_phase2str(enum rq_phase phase)return "Interpret" ;case RQ_PHASE_COMPLETE :return "Complete" ; -case RQ_PHASE_UNREGISTERING : -return "Unregistering" ; +case RQ_PHASE_UNREG_RPC : +return "UnregRPC" ; +case RQ_PHASE_UNREG_BULK : +return "UnregBULK" ;default :return "?Phase?" ; }
@@ -1721,7 +1727,7 @@ ptlrpc_rqphase2str(struct ptlrpc_request *req) #define DEBUG_REQ_FLAGS(req) \ ptlrpc_rqphase2str(req), \ FLAG(req->rq_intr, "I"), FLAG(req->rq_replied, "R"), \ - FLAG(req->rq_err, "E"), \ + FLAG(req->rq_err, "E"), FLAG(req->rq_net_err, "e"), \ FLAG(req->rq_timedout, "X") /* eXpired */, FLAG(req->rq_resend, "S"), \ FLAG(req->rq_restart, "T"), FLAG(req->rq_replay, "P"), \ FLAG(req->rq_no_resend, "N"), \
@@ -1729,7 +1735,7 @@ ptlrpc_rqphase2str(struct ptlrpc_request *req)FLAG (req->rq_wait_ctx,"C" ),FLAG (req->rq_hp,"H" ), \ FLAG(req->rq_committed, "M") -#define REQ_FLAGS_FMT "%s:%s%s%s%s%s%s%s%s%s%s%s%s" +#define REQ_FLAGS_FMT "%s:%s%s%s%s%s%s%s%s%s%s%s%s%s"void _debug_req (struct ptlrpc_request *req,struct libcfs_debug_msg_data *data,const char *fmt, ...)
@@ -2380,8 +2386,7 @@ static inline int ptlrpc_client_bulk_active(struct ptlrpc_request *req) desc = req->rq_bulk; -if (OBD_FAIL_CHECK (OBD_FAIL_PTLRPC_LONG_BULK_UNLINK ) && - req->rq_bulk_deadline >ktime_get_real_seconds ()) +if (req->rq_bulk_deadline >ktime_get_real_seconds ())return 1 ;if (!desc)
@@ -2728,13 +2733,20 @@ ptlrpc_rqphase_move(struct ptlrpc_request *req, enum rq_phase new_phase)if (req->rq_phase == new_phase)return ; -if (new_phase ==RQ_PHASE_UNREGISTERING ) { +if (new_phase ==RQ_PHASE_UNREG_RPC || + new_phase ==RQ_PHASE_UNREG_BULK ) { +/* No embedded unregistering phases */ +if (req->rq_phase ==RQ_PHASE_UNREG_RPC || + req->rq_phase ==RQ_PHASE_UNREG_BULK ) +return ; + req->rq_next_phase = req->rq_phase;if (req->rq_import)atomic_inc (&req->rq_import->imp_unregistering); } -if (req->rq_phase ==RQ_PHASE_UNREGISTERING ) { +if (req->rq_phase ==RQ_PHASE_UNREG_RPC || + req->rq_phase ==RQ_PHASE_UNREG_BULK ) {if (req->rq_import)atomic_dec (&req->rq_import->imp_unregistering); }
@@ -2751,9 +2763,6 @@ ptlrpc_rqphase_move(struct ptlrpc_request *req, enum rq_phase new_phase)static inline int ptlrpc_client_early (struct ptlrpc_request *req) { -if (OBD_FAIL_CHECK (OBD_FAIL_PTLRPC_LONG_REPL_UNLINK ) && - req->rq_reply_deadline >ktime_get_real_seconds ()) -return 0 ;return req->rq_early; }
@@ -2763,8 +2772,7 @@ ptlrpc_client_early(struct ptlrpc_request *req)static inline int ptlrpc_client_replied (struct ptlrpc_request *req) { -if (OBD_FAIL_CHECK (OBD_FAIL_PTLRPC_LONG_REPL_UNLINK ) && - req->rq_reply_deadline >ktime_get_real_seconds ()) +if (req->rq_reply_deadline >ktime_get_real_seconds ())return 0 ;return req->rq_replied; }
@@ -2773,8 +2781,7 @@ ptlrpc_client_replied(struct ptlrpc_request *req)static inline int ptlrpc_client_recv (struct ptlrpc_request *req) { -if (OBD_FAIL_CHECK (OBD_FAIL_PTLRPC_LONG_REPL_UNLINK ) && - req->rq_reply_deadline >ktime_get_real_seconds ()) +if (req->rq_reply_deadline >ktime_get_real_seconds ())return 1 ;return req->rq_receiving_reply; }
@@ -2785,8 +2792,11 @@ ptlrpc_client_recv_or_unlink(struct ptlrpc_request *req)int rc;spin_lock (&req->rq_lock); -if (OBD_FAIL_CHECK (OBD_FAIL_PTLRPC_LONG_REPL_UNLINK ) && - req->rq_reply_deadline >ktime_get_real_seconds ()) { +if (req->rq_reply_deadline >ktime_get_real_seconds ()) { +spin_unlock (&req->rq_lock); +return 1 ; + } +if (req->rq_req_deadline >ktime_get_real_seconds ()) {spin_unlock (&req->rq_lock);return 1 ; }
drivers/staging/lustre/lustre/include/obd_support.h +3 -0
@@ -364,6 +364,9 @@ extern char obd_jobid_var[];#define OBD_FAIL_PTLRPC_CLIENT_BULK_CB2 0x515#define OBD_FAIL_PTLRPC_DELAY_IMP_FULL 0x516#define OBD_FAIL_PTLRPC_CANCEL_RESEND 0x517 +#define OBD_FAIL_PTLRPC_DROP_BULK 0x51a +#define OBD_FAIL_PTLRPC_LONG_REQ_UNLINK 0x51b +#define OBD_FAIL_PTLRPC_LONG_BOTH_UNLINK 0x51c#define OBD_FAIL_OBD_PING_NET 0x600#define OBD_FAIL_OBD_LOG_CANCEL_NET 0x601
drivers/staging/lustre/lustre/ptlrpc/client.c +56 -8
120 lines not on this page · raw message
drivers/staging/lustre/lustre/ptlrpc/import.c +1 -2
@@ -356,9 +356,8 @@ void ptlrpc_invalidate_import(struct obd_import *imp) "still on delayed list"); } -CERROR ("%s: RPCs in \"%s\" phase found (%d). Network is sluggish? Waiting them to error out.\n" , +CERROR ("%s: Unregistering RPCs found (%d). Network is sluggish? Waiting them to error out.\n" , cli_tgt, -ptlrpc_phase2str (RQ_PHASE_UNREGISTERING ),atomic_read (&imp-> imp_unregistering)); }
drivers/staging/lustre/lustre/ptlrpc/niobuf.c +2 -2
@@ -247,7 +247,7 @@ int ptlrpc_unregister_bulk(struct ptlrpc_request *req, int async)/* Let's setup deadline for reply unlink. */ if (OBD_FAIL_CHECK (OBD_FAIL_PTLRPC_LONG_BULK_UNLINK ) && - async && req->rq_bulk_deadline ==0 ) + async && req->rq_bulk_deadline ==0 && cfs_fail_val ==0 ) req->rq_bulk_deadline =ktime_get_real_seconds () +LONG_UNLINK ;if (ptlrpc_client_bulk_active (req) ==0 )/* completed or */
@@ -266,7 +266,7 @@ int ptlrpc_unregister_bulk(struct ptlrpc_request *req, int async)return 1 ;/* never registered */ /* Move to "Unregistering" phase as bulk was not unlinked yet. */ -ptlrpc_rqphase_move (req,RQ_PHASE_UNREGISTERING ); +ptlrpc_rqphase_move (req,RQ_PHASE_UNREG_BULK );/* Do not wait for unlink to finish. */ if (async)
Signature · 1 line
2.7.4
PATCH 12/28 staging/lustre/llite: take trunc_sem only at vvp layer
In reply to Oleg DrokinFrom: Patrick Farrell <[email protected]>
The lli_trunc_sem is taken in 'read' mode in both ll_page_mkwrite and vvp_io_fault_start. This can lead to a deadlock with another thread which asks for the semaphore in write mode between thse two read calls.
Since all users of lli_trunc_sem are in the vvp layer, we can satisfy the requirement to exclude truncate by taking the semaphore only in vvp_io_fault_start.
Reviewed-on: http://review.whamcloud.com/19315
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7981
--- drivers/staging/lustre/lustre/llite/llite_mmap.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/staging/lustre/lustre/llite/llite_mmap.c +0 -7
@@ -196,18 +196,11 @@ static int ll_page_mkwrite0(struct vm_area_struct *vma, struct page *vmpage, set =cfs_block_sigsinv (sigmask (SIGKILL ) |sigmask (SIGTERM )); -/* we grab lli_trunc_sem to exclude truncate case. -* Otherwise, we could add dirty pages into osc cache -* while truncate is on-going. -*/ inode =vvp_object_inode (io->ci_obj); lli =ll_i2info (inode); -down_read (&lli->lli_trunc_sem); result =cl_io_loop (env, io); -up_read (&lli->lli_trunc_sem); -cfs_restore_sigs (set);if (result ==0 ) {
Signature · 1 line
2.7.4
PATCH 13/28 staging/lustre: LDLM_DEBUG() shouldn't be passed \n
In reply to Oleg DrokinFrom: Alex Zhuravlev <[email protected]>
as it adds own \n, so any extra \n break log format.
Reviewed-on: http://review.whamcloud.com/17494
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7521
--- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 2 +- drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 3 ++- drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 2 +- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 2 +- drivers/staging/lustre/lustre/lov/lov_object.c | 4 ++-- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 2 +- drivers/staging/lustre/lustre/osc/osc_cache.c | 4 ++-- drivers/staging/lustre/lustre/osc/osc_lock.c | 2 +- 8 files changed, 11 insertions(+), 10 deletions(-)
drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +1 -1
@@ -1440,7 +1440,7 @@ int ldlm_fill_lvb(struct ldlm_lock *lock, struct req_capsule *pill,memcpy (data, lvb, size);break ;default : -LDLM_ERROR (lock,"Unknown LVB type: %d\n" , lock->l_lvb_type); +LDLM_ERROR (lock,"Unknown LVB type: %d" , lock->l_lvb_type);dump_stack ();return -EINVAL ; }
drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c +2 -1
@@ -637,7 +637,8 @@ static int ldlm_callback_handler(struct ptlrpc_request *req)*/ if ((ldlm_is_canceling (lock) &&ldlm_is_bl_done (lock)) ||ldlm_is_failed (lock)) { -LDLM_DEBUG (lock,"callback on lock %#llx - lock disappeared\n" , +LDLM_DEBUG (lock, +"callback on lock %#llx - lock disappeared" , dlm_req->lock_handle[0 ].cookie);unlock_res_and_lock (lock);LDLM_LOCK_RELEASE (lock);
drivers/staging/lustre/lustre/ldlm/ldlm_request.c +1 -1
@@ -711,7 +711,7 @@ int ldlm_cli_enqueue(struct obd_export *exp, struct ptlrpc_request **reqp, lock->l_req_extent = policy->l_extent; } -LDLM_DEBUG (lock,"client-side enqueue START, flags %llx\n" , +LDLM_DEBUG (lock,"client-side enqueue START, flags %llx" , *flags); }
drivers/staging/lustre/lustre/ldlm/ldlm_resource.c +1 -1
@@ -1275,7 +1275,7 @@ void ldlm_resource_add_lock(struct ldlm_resource *res, struct list_head *head, {check_res_locked (res); -LDLM_DEBUG (lock,"About to add this lock:\n" ); +LDLM_DEBUG (lock,"About to add this lock:" );if (ldlm_is_destroyed (lock)) {CDEBUG (D_OTHER ,"Lock destroyed, not adding to resource\n" );
drivers/staging/lustre/lustre/lov/lov_object.c +2 -2
@@ -181,8 +181,8 @@ static int lov_init_sub(const struct lu_env *env, struct lov_object *lov, }LU_OBJECT_DEBUG (mask, env, &stripe->co_lu, -"stripe %d is already owned.\n" , idx); -LU_OBJECT_DEBUG (mask, env, old_obj,"owned.\n" ); +"stripe %d is already owned." , idx); +LU_OBJECT_DEBUG (mask, env, old_obj,"owned." );LU_OBJECT_HEADER (mask, env,lov2lu (lov),"try to own.\n" );cl_object_put (env, stripe); }
drivers/staging/lustre/lustre/mdc/mdc_locks.c +1 -1
@@ -711,7 +711,7 @@ static int mdc_finish_enqueue(struct obd_export *exp,if (lock &&ldlm_has_layout (lock) && lvb_data) {void *lmm; -LDLM_DEBUG (lock,"layout lock returned by: %s, lvb_len: %d\n" , +LDLM_DEBUG (lock,"layout lock returned by: %s, lvb_len: %d" ,ldlm_it2str (it->it_op), lvb_len); lmm =libcfs_kvzalloc (lvb_len,GFP_NOFS );
drivers/staging/lustre/lustre/osc/osc_cache.c +2 -2
@@ -123,9 +123,9 @@ static const char *oes_strings[] = {/* ----- part 4 ----- */ \ ## __VA_ARGS__); \if (lvl ==D_ERROR && __ext->oe_dlmlock) \ -LDLM_ERROR (__ext->oe_dlmlock,"extent: %p\n" , __ext); \ +LDLM_ERROR (__ext->oe_dlmlock,"extent: %p" , __ext); \else \ -LDLM_DEBUG (__ext->oe_dlmlock,"extent: %p\n" , __ext); \ +LDLM_DEBUG (__ext->oe_dlmlock,"extent: %p" , __ext); \ }while (0 ) #undef EASSERTF
drivers/staging/lustre/lustre/osc/osc_lock.c +1 -1
@@ -1168,7 +1168,7 @@ int osc_lock_init(const struct lu_env *env,osc_lock_set_writer (env, io, obj, oscl); -LDLM_DEBUG_NOLOCK ("lock %p, osc lock %p, flags %llx\n" , +LDLM_DEBUG_NOLOCK ("lock %p, osc lock %p, flags %llx" , lock, oscl, oscl->ols_flags);return 0 ;
Signature · 1 line
2.7.4
PATCH 14/28 staging/lustre: Add newline to LU_OBJECT_DEBUG() message
In reply to Oleg DrokinFrom: Bob Glossman <[email protected]>
LU_OBJECT_DEBUG expects non \n terminated message from the caller, so it should add it's own to keep debug logger happy.
Reviewed-on: http://review.whamcloud.com/19960
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8094
--- drivers/staging/lustre/lustre/include/lu_object.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/include/lu_object.h +1 -1
@@ -779,7 +779,7 @@ do { \if (cfs_cdebug_show (mask,DEBUG_SUBSYSTEM )) { \LIBCFS_DEBUG_MSG_DATA_DECL (msgdata, mask,NULL ); \lu_object_print (env, &msgdata, lu_cdebug_printer, object);\ - CDEBUG(mask, format, ## __VA_ARGS__); \ + CDEBUG(mask, format "\n", ## __VA_ARGS__); \ } \ }while (0 )
Signature · 1 line
2.7.4
PATCH 15/28 staging/lustre/llite: flatten struct lookup_intent
In reply to Oleg DrokinFrom: "John L. Hammond" <[email protected]>
Replace the union in struct lookup_intent with the members of struct lustre_indent_data. Remove the then unused struct lustre_intent_data.
Reviewed-on: http://review.whamcloud.com/17069
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7403
--- .../staging/lustre/lustre/include/lustre_intent.h | 15 ++-- drivers/staging/lustre/lustre/llite/dcache.c | 26 +++---- drivers/staging/lustre/lustre/llite/dir.c | 4 +- drivers/staging/lustre/lustre/llite/file.c | 44 ++++++------ .../staging/lustre/lustre/llite/llite_internal.h | 14 ++-- drivers/staging/lustre/lustre/llite/llite_lib.c | 4 +- drivers/staging/lustre/lustre/llite/namei.c | 8 +-- drivers/staging/lustre/lustre/llite/statahead.c | 10 +-- drivers/staging/lustre/lustre/llite/xattr_cache.c | 16 ++--- drivers/staging/lustre/lustre/lmv/lmv_intent.c | 26 +++---- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 8 +-- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 79 +++++++++++----------- drivers/staging/lustre/lustre/mdc/mdc_request.c | 2 +- 13 files changed, 125 insertions(+), 131 deletions(-)
drivers/staging/lustre/lustre/include/lustre_intent.h +5 -10
@@ -34,7 +34,11 @@#define LUSTRE_INTENT_H /* intent IT_XXX are defined in lustre/include/obd.h */ -struct lustre_intent_data { + +struct lookup_intent { +int it_op; +int it_create_mode; +__u64 it_flags;int it_disposition;int it_status;__u64 it_lock_handle;
@@ -46,13 +50,4 @@ struct lustre_intent_data { unsigned int it_lock_set:1; }; -struct lookup_intent { -int it_op; -int it_create_mode; -__u64 it_flags; -union { -struct lustre_intent_data lustre; - } d; -}; -#endif
drivers/staging/lustre/lustre/llite/dcache.c +13 -13
@@ -202,27 +202,27 @@ int ll_d_init(struct dentry *de)void ll_intent_drop_lock (struct lookup_intent *it) { -if (it->it_op && it->d.lustre.it_lock_mode) { +if (it->it_op && it->it_lock_mode) {struct lustre_handle handle; - handle.cookie = it->d.lustre.it_lock_handle; + handle.cookie = it->it_lock_handle;CDEBUG (D_DLMTRACE ,"releasing lock with cookie %#llx from it %p\n" , handle.cookie, it); -ldlm_lock_decref (&handle, it->d.lustre.it_lock_mode); +ldlm_lock_decref (&handle, it->it_lock_mode);/* bug 494: intent_release may be called multiple times, from * this thread and we don't want to double-decref this lock */ - it->d.lustre.it_lock_mode =0 ; -if (it->d.lustre.it_remote_lock_mode !=0 ) { - handle.cookie = it->d.lustre.it_remote_lock_handle; + it->it_lock_mode =0 ; +if (it->it_remote_lock_mode !=0 ) { + handle.cookie = it->it_remote_lock_handle;CDEBUG (D_DLMTRACE ,"releasing remote lock with cookie%#llx from it %p\n" , handle.cookie, it);ldlm_lock_decref (&handle, - it->d.lustre.it_remote_lock_mode); - it->d.lustre.it_remote_lock_mode =0 ; + it->it_remote_lock_mode); + it->it_remote_lock_mode =0 ; } } }
@@ -233,13 +233,13 @@ void ll_intent_release(struct lookup_intent *it)ll_intent_drop_lock (it);/* We are still holding extra reference on a request, need to free it */ if (it_disposition (it,DISP_ENQ_OPEN_REF )) -ptlrpc_req_finished (it->d.lustre.it_data);/* ll_file_open */ +ptlrpc_req_finished (it->it_data);/* ll_file_open */ if (it_disposition (it,DISP_ENQ_CREATE_REF ))/* create rec */ -ptlrpc_req_finished (it->d.lustre.it_data); +ptlrpc_req_finished (it->it_data); - it->d.lustre.it_disposition =0 ; - it->d.lustre.it_data =NULL ; + it->it_disposition =0 ; + it->it_data =NULL ; }void ll_invalidate_aliases (struct inode *inode)
@@ -279,7 +279,7 @@ int ll_revalidate_it_finish(struct ptlrpc_request *request,void ll_lookup_finish_locks (struct lookup_intent *it,struct inode *inode) { -if (it->d.lustre.it_lock_mode && inode) { +if (it->it_lock_mode && inode) {struct ll_sb_info *sbi =ll_i2sbi (inode); CDEBUG(D_DLMTRACE, "setting l_data to inode "DFID"(%p)\n",
drivers/staging/lustre/lustre/llite/dir.c +2 -2
@@ -362,7 +362,7 @@ struct page *ll_get_dir_page(struct inode *dir, __u64 hash,ll_finish_md_op_data (op_data); - request = (struct ptlrpc_request *)it.d.lustre.it_data; + request = (struct ptlrpc_request *)it.it_data;if (request)ptlrpc_req_finished (request);if (rc <0 ) {
@@ -374,7 +374,7 @@ struct page *ll_get_dir_page(struct inode *dir, __u64 hash,CDEBUG (D_INODE ,"setting lr_lvb_inode to inode " DFID "(%p)\n" ,PFID (ll_inode2fid (dir)), dir);md_set_lock_data (ll_i2sbi (dir)->ll_md_exp, - &it.d.lustre.it_lock_handle, dir,NULL ); + &it.it_lock_handle, dir,NULL ); }else {/* for cross-ref object, l_ast_data of the lock may not be set, * we reset it here
drivers/staging/lustre/lustre/llite/file.c +22 -22
133 lines not on this page · raw message
drivers/staging/lustre/lustre/llite/llite_internal.h +7 -7
@@ -1280,7 +1280,7 @@ static inline int ll_file_nolock(const struct file *file)static inline void ll_set_lock_data (struct obd_export *exp,struct inode *inode,struct lookup_intent *it,__u64 *bits) { -if (!it->d.lustre.it_lock_set) { +if (!it->it_lock_set) {struct lustre_handle handle;/* If this inode is a remote object, it will get two
@@ -1291,26 +1291,26 @@ static inline void ll_set_lock_data(struct obd_export *exp, struct inode *inode,* LOOKUP and PERM locks, so revoking either locks will * case the dcache being cleared */ -if (it->d.lustre.it_remote_lock_mode) { - handle.cookie = it->d.lustre.it_remote_lock_handle; +if (it->it_remote_lock_mode) { + handle.cookie = it->it_remote_lock_handle;CDEBUG (D_DLMTRACE ,"setting l_data to inode " DFID "%p for remote lock %#llx\n" ,PFID (ll_inode2fid (inode)), inode, handle.cookie);md_set_lock_data (exp, &handle.cookie, inode,NULL ); } - handle.cookie = it->d.lustre.it_lock_handle; + handle.cookie = it->it_lock_handle;CDEBUG (D_DLMTRACE ,"setting l_data to inode " DFID "%p for lock %#llx\n" ,PFID (ll_inode2fid (inode)), inode, handle.cookie);md_set_lock_data (exp, &handle.cookie, inode, - &it->d.lustre.it_lock_bits); - it->d.lustre.it_lock_set =1 ; + &it->it_lock_bits); + it->it_lock_set =1 ; }if (bits) - *bits = it->d.lustre.it_lock_bits; + *bits = it->it_lock_bits; }static inline int d_lustre_invalid (const struct dentry *dentry)
drivers/staging/lustre/lustre/llite/llite_lib.c +2 -2
@@ -1998,11 +1998,11 @@ int ll_prep_inode(struct inode **inode, struct ptlrpc_request *req,* 3. proc2: refresh layout and layout lock granted * 4. proc1: to apply a stale layout */ -if (it && it->d.lustre.it_lock_mode !=0 ) { +if (it && it->it_lock_mode !=0 ) {struct lustre_handle lockh;struct ldlm_lock *lock; - lockh.cookie = it->d.lustre.it_lock_handle; + lockh.cookie = it->it_lock_handle; lock =ldlm_handle2lock (&lockh);LASSERT (lock);if (ldlm_has_layout (lock)) {
drivers/staging/lustre/lustre/llite/namei.c +4 -4
@@ -393,7 +393,7 @@ static int ll_lookup_it_finish(struct ptlrpc_request *request,* when I return */ CDEBUG (D_DENTRY ,"it %p it_disposition %x\n" , it, - it->d.lustre.it_disposition); + it->it_disposition);if (!it_disposition (it,DISP_LOOKUP_NEG )) { rc =ll_prep_inode (&inode, request, (*de)->d_sb, it);if (rc)
@@ -445,7 +445,7 @@ static int ll_lookup_it_finish(struct ptlrpc_request *request,/* Check that parent has UPDATE lock. */ struct lookup_intent parent_it = { .it_op =IT_GETATTR , - .d.lustre.it_lock_handle =0 }; + .it_lock_handle =0 };if (md_revalidate_lock (ll_i2mdexp (parent), &parent_it, &ll_i2info (parent)->lli_fid,NULL )) {
@@ -656,10 +656,10 @@ static struct inode *ll_create_node(struct inode *dir, struct lookup_intent *it)struct ll_sb_info *sbi =ll_i2sbi (dir);int rc; -LASSERT (it && it->d.lustre.it_disposition); +LASSERT (it && it->it_disposition);LASSERT (it_disposition (it,DISP_ENQ_CREATE_REF )); - request = it->d.lustre.it_data; + request = it->it_data;it_clear_disposition (it,DISP_ENQ_CREATE_REF ); rc =ll_prep_inode (&inode, request, dir->i_sb, it);if (rc) {
drivers/staging/lustre/lustre/llite/statahead.c +5 -5
@@ -646,7 +646,7 @@ static void ll_post_statahead(struct ll_statahead_info *sai) } } - it->d.lustre.it_lock_handle = entry->se_handle; + it->it_lock_handle = entry->se_handle; rc =md_revalidate_lock (ll_i2mdexp (dir), it,ll_inode2fid (dir),NULL );if (rc !=1 ) { rc = -EAGAIN ;
@@ -700,7 +700,7 @@ static int ll_statahead_interpret(struct ptlrpc_request *req,* process enqueues lock on child with parent lock held, eg. * unlink. */ - handle = it->d.lustre.it_lock_handle; + handle = it->it_lock_handle;ll_intent_drop_lock (it); }
@@ -850,7 +850,7 @@ static int do_sa_revalidate(struct inode *dir, struct ll_sa_entry *entry, {struct inode *inode =d_inode (dentry);struct lookup_intent it = { .it_op =IT_GETATTR , - .d.lustre.it_lock_handle =0 }; + .it_lock_handle =0 };struct md_enqueue_info *minfo;struct ldlm_enqueue_info *einfo;int rc;
@@ -865,7 +865,7 @@ static int do_sa_revalidate(struct inode *dir, struct ll_sa_entry *entry, rc =md_revalidate_lock (ll_i2mdexp (dir), &it,ll_inode2fid (inode),NULL );if (rc ==1 ) { - entry->se_handle = it.d.lustre.it_lock_handle; + entry->se_handle = it.it_lock_handle;ll_intent_release (&it);return 1 ; }
@@ -1569,7 +1569,7 @@ int do_statahead_enter(struct inode *dir, struct dentry **dentryp,if (entry->se_stat ==SA_ENTRY_SUCC && entry->se_inode) {struct inode *inode = entry->se_inode;struct lookup_intent it = { .it_op =IT_GETATTR , - .d.lustre.it_lock_handle = + .it_lock_handle = entry->se_handle };__u64 bits;
drivers/staging/lustre/lustre/llite/xattr_cache.c +8 -8
@@ -288,8 +288,8 @@ static int ll_xattr_find_get_lock(struct inode *inode, LCK_PR);if (mode !=0 ) {/* fake oit in mdc_revalidate_lock() manner */ - oit->d.lustre.it_lock_handle = lockh.cookie; - oit->d.lustre.it_lock_mode = mode; + oit->it_lock_handle = lockh.cookie; + oit->it_lock_mode = mode; goto out; } }
@@ -315,7 +315,7 @@ static int ll_xattr_find_get_lock(struct inode *inode,return rc; } - *req = (struct ptlrpc_request *)oit->d.lustre.it_data; + *req = (struct ptlrpc_request *)oit->it_data; out:down_write (&lli->lli_xattrs_list_rwsem);mutex_unlock (&lli->lli_xattrs_enq_lock);
@@ -362,10 +362,10 @@ static int ll_xattr_cache_refill(struct inode *inode, struct lookup_intent *oit) goto out_maybe_drop; } -if (oit->d.lustre.it_status <0 ) { +if (oit->it_status <0 ) {CDEBUG (D_CACHE ,"getxattr intent returned %d for fid " DFID "\n" , - oit->d.lustre.it_status,PFID (ll_inode2fid (inode))); - rc = oit->d.lustre.it_status; + oit->it_status,PFID (ll_inode2fid (inode))); + rc = oit->it_status;/* xattr data is so large that we don't want to cache it */ if (rc == -ERANGE ) rc = -EAGAIN ;
@@ -448,8 +448,8 @@ out_destroy:up_write (&lli->lli_xattrs_list_rwsem);ldlm_lock_decref_and_cancel ((struct lustre_handle *) - &oit->d.lustre.it_lock_handle, - oit->d.lustre.it_lock_mode); + &oit->it_lock_handle, + oit->it_lock_mode); goto out_no_unlock; }
drivers/staging/lustre/lustre/lmv/lmv_intent.c +13 -13
@@ -80,11 +80,11 @@ static int lmv_intent_remote(struct obd_export *exp, void *lmm,/* * We got LOOKUP lock, but we really need attrs. */ - pmode = it->d.lustre.it_lock_mode; + pmode = it->it_lock_mode;if (pmode) { - plock.cookie = it->d.lustre.it_lock_handle; - it->d.lustre.it_lock_mode =0 ; - it->d.lustre.it_data =NULL ; + plock.cookie = it->it_lock_handle; + it->it_lock_mode =0 ; + it->it_data =NULL ; }LASSERT (fid_is_sane (&body->fid1));
@@ -130,14 +130,14 @@ static int lmv_intent_remote(struct obd_export *exp, void *lmm,* maintain dcache consistency. Thus drop UPDATE|PERM lock here * and put LOOKUP in request. */ -if (it->d.lustre.it_lock_mode !=0 ) { - it->d.lustre.it_remote_lock_handle = - it->d.lustre.it_lock_handle; - it->d.lustre.it_remote_lock_mode = it->d.lustre.it_lock_mode; +if (it->it_lock_mode !=0 ) { + it->it_remote_lock_handle = + it->it_lock_handle; + it->it_remote_lock_mode = it->it_lock_mode; } - it->d.lustre.it_lock_handle = plock.cookie; - it->d.lustre.it_lock_mode = pmode; + it->it_lock_handle = plock.cookie; + it->it_lock_mode = pmode; out_free_op_data:kfree (op_data);
@@ -197,9 +197,9 @@ static int lmv_intent_open(struct obd_export *exp, struct md_op_data *op_data,* Nothing is found, do not access body->fid1 as it is zero and thus * pointless. */ -if ((it->d.lustre.it_disposition &DISP_LOOKUP_NEG ) && - !(it->d.lustre.it_disposition &DISP_OPEN_CREATE ) && - !(it->d.lustre.it_disposition &DISP_OPEN_OPEN )) +if ((it->it_disposition &DISP_LOOKUP_NEG ) && + !(it->it_disposition &DISP_OPEN_CREATE ) && + !(it->it_disposition &DISP_OPEN_OPEN ))return rc; body =req_capsule_server_get (&(*reqp)->rq_pill, &RMF_MDT_BODY );
drivers/staging/lustre/lustre/lmv/lmv_obd.c +4 -4
@@ -1679,7 +1679,7 @@ lmv_enqueue_remote(struct obd_export *exp, struct ldlm_enqueue_info *einfo, struct lustre_handle *lockh, void *lmm, int lmmsize, __u64 extra_lock_flags) { - struct ptlrpc_request *req = it->d.lustre.it_data; + struct ptlrpc_request *req = it->it_data;struct obd_device *obd = exp->exp_obd;struct lmv_obd *lmv = &obd->u.lmv;struct lustre_handle plock;
@@ -1701,11 +1701,11 @@ lmv_enqueue_remote(struct obd_export *exp, struct ldlm_enqueue_info *einfo,/* * We got LOOKUP lock, but we really need attrs. */ - pmode = it->d.lustre.it_lock_mode; + pmode = it->it_lock_mode;LASSERT (pmode !=0 );memcpy (&plock, lockh,sizeof (plock)); - it->d.lustre.it_lock_mode =0 ; - it->d.lustre.it_data =NULL ; + it->it_lock_mode =0 ; + it->it_data =NULL ; fid1 = body->fid1;ptlrpc_req_finished (req);
drivers/staging/lustre/lustre/mdc/mdc_locks.c +39 -40
212 lines not on this page · raw message
drivers/staging/lustre/lustre/mdc/mdc_request.c +1 -1
@@ -661,7 +661,7 @@ int mdc_set_open_replay_data(struct obd_export *exp,struct md_open_data *mod;struct mdt_rec_create *rec;struct mdt_body *body; -struct ptlrpc_request *open_req = it->d.lustre.it_data; +struct ptlrpc_request *open_req = it->it_data;struct obd_import *imp = open_req->rq_import;if (!open_req->rq_replay)
Signature · 1 line
2.7.4
PATCH 16/28 staging/lustre: Inline Lustre intent disposition functions
In reply to Oleg DrokinThey are just one-liners, so no point in having them exported and called through a different module.
--- drivers/staging/lustre/lustre/include/lustre_intent.h | 15 +++++++++++++++ drivers/staging/lustre/lustre/include/lustre_mdc.h | 3 --- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 18 ------------------ 3 files changed, 15 insertions(+), 21 deletions(-)
drivers/staging/lustre/lustre/include/lustre_intent.h +15 -0
@@ -50,4 +50,19 @@ struct lookup_intent { unsigned int it_lock_set:1; }; +static inline int it_disposition (struct lookup_intent *it,int flag) +{ +return it->it_disposition & flag; +} + +static inline void it_set_disposition (struct lookup_intent *it,int flag) +{ + it->it_disposition |= flag; +} + +static inline void it_clear_disposition (struct lookup_intent *it,int flag) +{ + it->it_disposition &= ~flag; +} +#endif
drivers/staging/lustre/lustre/include/lustre_mdc.h +0 -3
@@ -185,9 +185,6 @@ struct mdc_cache_waiter { };/* mdc/mdc_locks.c */ -int it_disposition (struct lookup_intent *it,int flag); -void it_clear_disposition (struct lookup_intent *it,int flag); -void it_set_disposition (struct lookup_intent *it,int flag);int it_open_error (int phase,struct lookup_intent *it);static inline bool cl_is_lov_delay_create (unsigned int flags)
drivers/staging/lustre/lustre/mdc/mdc_locks.c +0 -18
@@ -50,24 +50,6 @@ struct mdc_getattr_args {struct ldlm_enqueue_info *ga_einfo; }; -int it_disposition (struct lookup_intent *it,int flag) -{ -return it->it_disposition & flag; -} -EXPORT_SYMBOL (it_disposition); - -void it_set_disposition (struct lookup_intent *it,int flag) -{ - it->it_disposition |= flag; -} -EXPORT_SYMBOL (it_set_disposition); - -void it_clear_disposition (struct lookup_intent *it,int flag) -{ - it->it_disposition &= ~flag; -} -EXPORT_SYMBOL (it_clear_disposition); -int it_open_error (int phase,struct lookup_intent *it) {if (it_disposition (it,DISP_OPEN_LEASE )) {
Signature · 1 line
2.7.4
PATCH 17/28 staging/lustre/llite: change it_data to it_request
In reply to Oleg DrokinFrom: "John L. Hammond" <[email protected]>
Change the void *it_data member of struct lookup_intent to struct ptlrpc_request *it_request.
Reviewed-on: http://review.whamcloud.com/17070
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7403
--- drivers/staging/lustre/lustre/include/lustre_intent.h | 2 +- drivers/staging/lustre/lustre/llite/dcache.c | 6 +++--- drivers/staging/lustre/lustre/llite/dir.c | 2 +- drivers/staging/lustre/lustre/llite/file.c | 17 ++++++++--------- drivers/staging/lustre/lustre/llite/namei.c | 2 +- drivers/staging/lustre/lustre/llite/xattr_cache.c | 2 +- drivers/staging/lustre/lustre/lmv/lmv_intent.c | 2 +- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 4 ++-- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 6 +++--- drivers/staging/lustre/lustre/mdc/mdc_request.c | 2 +- 10 files changed, 22 insertions(+), 23 deletions(-)
drivers/staging/lustre/lustre/include/lustre_intent.h +1 -1
@@ -46,7 +46,7 @@ struct lookup_intent {int it_lock_mode;int it_remote_lock_mode;__u64 it_remote_lock_handle; -void *it_data; +struct ptlrpc_request *it_request; unsigned int it_lock_set:1; };
drivers/staging/lustre/lustre/llite/dcache.c +3 -3
@@ -233,13 +233,13 @@ void ll_intent_release(struct lookup_intent *it)ll_intent_drop_lock (it);/* We are still holding extra reference on a request, need to free it */ if (it_disposition (it,DISP_ENQ_OPEN_REF )) -ptlrpc_req_finished (it->it_data);/* ll_file_open */ +ptlrpc_req_finished (it->it_request);/* ll_file_open */ if (it_disposition (it,DISP_ENQ_CREATE_REF ))/* create rec */ -ptlrpc_req_finished (it->it_data); +ptlrpc_req_finished (it->it_request); it->it_disposition =0 ; - it->it_data =NULL ; + it->it_request =NULL ; }void ll_invalidate_aliases (struct inode *inode)
drivers/staging/lustre/lustre/llite/dir.c +1 -1
@@ -362,7 +362,7 @@ struct page *ll_get_dir_page(struct inode *dir, __u64 hash,ll_finish_md_op_data (op_data); - request = (struct ptlrpc_request *)it.it_data; + request = (struct ptlrpc_request *)it.it_request;if (request)ptlrpc_req_finished (request);if (rc <0 ) {
drivers/staging/lustre/lustre/llite/file.c +8 -9
@@ -476,10 +476,9 @@ void ll_ioepoch_open(struct ll_inode_info *lli, __u64 ioepoch)static int ll_och_fill (struct obd_export *md_exp,struct lookup_intent *it,struct obd_client_handle *och) { -struct ptlrpc_request *req = it->it_data;struct mdt_body *body; - body =req_capsule_server_get (&req->rq_pill, &RMF_MDT_BODY ); + body =req_capsule_server_get (&it->it_request->rq_pill, &RMF_MDT_BODY ); och->och_fh = body->handle; och->och_fid = body->fid1; och->och_lease_handle.cookie = it->it_lock_handle;
@@ -500,7 +499,6 @@ static int ll_local_open(struct file *file, struct lookup_intent *it,LASSERT (fd);if (och) { -struct ptlrpc_request *req = it->it_data;struct mdt_body *body;int rc;
@@ -508,7 +506,8 @@ static int ll_local_open(struct file *file, struct lookup_intent *it,if (rc !=0 )return rc; - body =req_capsule_server_get (&req->rq_pill, &RMF_MDT_BODY ); + body =req_capsule_server_get (&it->it_request->rq_pill, + &RMF_MDT_BODY );ll_ioepoch_open (lli, body->ioepoch); }
@@ -725,7 +724,7 @@ out_openerr: }if (it &&it_disposition (it,DISP_ENQ_OPEN_REF )) { -ptlrpc_req_finished (it->it_data); +ptlrpc_req_finished (it->it_request);it_clear_disposition (it,DISP_ENQ_OPEN_REF ); }
@@ -1413,7 +1412,7 @@ out_unlock: out:return rc; out_req_free: -ptlrpc_req_finished ((struct ptlrpc_request *)oit.it_data); +ptlrpc_req_finished ((struct ptlrpc_request *)oit.it_request); goto out; }
@@ -1701,7 +1700,7 @@ int ll_release_openhandle(struct inode *inode, struct lookup_intent *it) out:/* this one is in place of ll_file_open */ if (it_disposition (it,DISP_ENQ_OPEN_REF )) { -ptlrpc_req_finished (it->it_data); +ptlrpc_req_finished (it->it_request);it_clear_disposition (it,DISP_ENQ_OPEN_REF ); }return rc;
@@ -3610,8 +3609,8 @@ again: rc =md_enqueue (sbi->ll_md_exp, &einfo, &it, op_data, &lockh,NULL ,0 ,NULL ,0 ); -ptlrpc_req_finished (it.it_data); - it.it_data =NULL ; +ptlrpc_req_finished (it.it_request); + it.it_request =NULL ;ll_finish_md_op_data (op_data);
drivers/staging/lustre/lustre/llite/namei.c +1 -1
@@ -659,7 +659,7 @@ static struct inode *ll_create_node(struct inode *dir, struct lookup_intent *it)LASSERT (it && it->it_disposition);LASSERT (it_disposition (it,DISP_ENQ_CREATE_REF )); - request = it->it_data; + request = it->it_request;it_clear_disposition (it,DISP_ENQ_CREATE_REF ); rc =ll_prep_inode (&inode, request, dir->i_sb, it);if (rc) {
drivers/staging/lustre/lustre/llite/xattr_cache.c +1 -1
@@ -315,7 +315,7 @@ static int ll_xattr_find_get_lock(struct inode *inode,return rc; } - *req = (struct ptlrpc_request *)oit->it_data; + *req = oit->it_request; out:down_write (&lli->lli_xattrs_list_rwsem);mutex_unlock (&lli->lli_xattrs_enq_lock);
drivers/staging/lustre/lustre/lmv/lmv_intent.c +1 -1
@@ -84,7 +84,7 @@ static int lmv_intent_remote(struct obd_export *exp, void *lmm,if (pmode) { plock.cookie = it->it_lock_handle; it->it_lock_mode =0 ; - it->it_data =NULL ; + it->it_request =NULL ; }LASSERT (fid_is_sane (&body->fid1));
drivers/staging/lustre/lustre/lmv/lmv_obd.c +2 -2
@@ -1679,7 +1679,7 @@ lmv_enqueue_remote(struct obd_export *exp, struct ldlm_enqueue_info *einfo, struct lustre_handle *lockh, void *lmm, int lmmsize, __u64 extra_lock_flags) { - struct ptlrpc_request *req = it->it_data; + struct ptlrpc_request *req = it->it_request;struct obd_device *obd = exp->exp_obd;struct lmv_obd *lmv = &obd->u.lmv;struct lustre_handle plock;
@@ -1705,7 +1705,7 @@ lmv_enqueue_remote(struct obd_export *exp, struct ldlm_enqueue_info *einfo,LASSERT (pmode !=0 );memcpy (&plock, lockh,sizeof (plock)); it->it_lock_mode =0 ; - it->it_data =NULL ; + it->it_request =NULL ; fid1 = body->fid1;ptlrpc_req_finished (req);
drivers/staging/lustre/lustre/mdc/mdc_locks.c +3 -3
@@ -570,7 +570,7 @@ static int mdc_finish_enqueue(struct obd_export *exp, it->it_status = (int )lockrep->lock_policy_res2; it->it_lock_mode = einfo->ei_mode; it->it_lock_handle = lockh->cookie; - it->it_data = req; + it->it_request = req;/* Technically speaking rq_transno must already be zero if * it_status is in error, so the check is a bit redundant
@@ -902,7 +902,7 @@ resend: it->it_lock_handle =0 ; it->it_lock_mode =0 ; - it->it_data =NULL ; + it->it_request =NULL ; }return rc;
@@ -1165,7 +1165,7 @@ int mdc_intent_lock(struct obd_export *exp, struct md_op_data *op_data,if (rc <0 )return rc; - *reqp = it->it_data; + *reqp = it->it_request; rc =mdc_finish_intent_lock (exp, *reqp, op_data, it, &lockh);return rc; }
drivers/staging/lustre/lustre/mdc/mdc_request.c +1 -1
@@ -661,7 +661,7 @@ int mdc_set_open_replay_data(struct obd_export *exp,struct md_open_data *mod;struct mdt_rec_create *rec;struct mdt_body *body; -struct ptlrpc_request *open_req = it->it_data; +struct ptlrpc_request *open_req = it->it_request;struct obd_import *imp = open_req->rq_import;if (!open_req->rq_replay)
Signature · 1 line
2.7.4
PATCH 18/28 staging/lustre/ldlm: const qualify struct lustre_handle * params
In reply to Oleg DrokinFrom: "John L. Hammond" <[email protected]>
Add a const qualifier to several struct lustre_handle * parameters in the LDLM interface.
Reviewed-on: http://review.whamcloud.com/17071
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7403
--- drivers/staging/lustre/lustre/include/lustre_dlm.h | 18 +++++++++--------- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 14 +++++++------- drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 2 +- drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 4 ++-- 4 files changed, 19 insertions(+), 19 deletions(-)
drivers/staging/lustre/lustre/include/lustre_dlm.h +9 -9
@@ -1073,7 +1073,7 @@ void ldlm_lock2handle(const struct ldlm_lock *lock,struct ldlm_lock *__ldlm_handle2lock (const struct lustre_handle *,__u64 flags);void ldlm_cancel_callback (struct ldlm_lock *);int ldlm_lock_remove_from_lru (struct ldlm_lock *); -int ldlm_lock_set_data (struct lustre_handle *,void *); +int ldlm_lock_set_data (const struct lustre_handle *lockh,void *data);/** * Obtain a lock reference by its handle.
@@ -1162,10 +1162,10 @@ do { \struct ldlm_lock *ldlm_lock_get (struct ldlm_lock *lock);void ldlm_lock_put (struct ldlm_lock *lock);void ldlm_lock2desc (struct ldlm_lock *lock,struct ldlm_lock_desc *desc); -void ldlm_lock_addref (struct lustre_handle *lockh,__u32 mode); -int ldlm_lock_addref_try (struct lustre_handle *lockh,__u32 mode); -void ldlm_lock_decref (struct lustre_handle *lockh,__u32 mode); -void ldlm_lock_decref_and_cancel (struct lustre_handle *lockh,__u32 mode); +void ldlm_lock_addref (const struct lustre_handle *lockh,__u32 mode); +int ldlm_lock_addref_try (const struct lustre_handle *lockh,__u32 mode); +void ldlm_lock_decref (const struct lustre_handle *lockh,__u32 mode); +void ldlm_lock_decref_and_cancel (const struct lustre_handle *lockh,__u32 mode);void ldlm_lock_fail_match_locked (struct ldlm_lock *lock);void ldlm_lock_allow_match (struct ldlm_lock *lock);void ldlm_lock_allow_match_locked (struct ldlm_lock *lock);
@@ -1174,10 +1174,10 @@ enum ldlm_mode ldlm_lock_match(struct ldlm_namespace *ns, __u64 flags, enum ldlm_type type, ldlm_policy_data_t *, enum ldlm_mode mode, struct lustre_handle *, int unref); -enum ldlm_mode ldlm_revalidate_lock_handle (struct lustre_handle *lockh, +enum ldlm_mode ldlm_revalidate_lock_handle (const struct lustre_handle *lockh,__u64 *bits);void ldlm_lock_cancel (struct ldlm_lock *lock); -void ldlm_lock_dump_handle (int level,struct lustre_handle *); +void ldlm_lock_dump_handle (int level,const struct lustre_handle *);void ldlm_unlink_lock_skiplist (struct ldlm_lock *req);/* resource.c */
@@ -1251,9 +1251,9 @@ int ldlm_cli_enqueue_fini(struct obd_export *exp, struct ptlrpc_request *req, enum ldlm_type type, __u8 with_policy, enum ldlm_mode mode, __u64 *flags, void *lvb, __u32 lvb_len, - struct lustre_handle *lockh, int rc); + const struct lustre_handle *lockh, int rc);int ldlm_cli_update_pool (struct ptlrpc_request *req); -int ldlm_cli_cancel (struct lustre_handle *lockh, +int ldlm_cli_cancel (const struct lustre_handle *lockh,enum ldlm_cancel_flags cancel_flags);int ldlm_cli_cancel_unused (struct ldlm_namespace *,const struct ldlm_res_id *,enum ldlm_cancel_flags flags,void *opaque);
drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +7 -7
@@ -658,7 +658,7 @@ static void ldlm_add_ast_work_item(struct ldlm_lock *lock,* r/w reference type is determined by \a mode * Calls ldlm_lock_addref_internal. */ -void ldlm_lock_addref (struct lustre_handle *lockh,__u32 mode) +void ldlm_lock_addref (const struct lustre_handle *lockh,__u32 mode) {struct ldlm_lock *lock;
@@ -700,7 +700,7 @@ void ldlm_lock_addref_internal_nolock(struct ldlm_lock *lock, __u32 mode)* * \retval -EAGAIN lock is being canceled. */ -int ldlm_lock_addref_try (struct lustre_handle *lockh,__u32 mode) +int ldlm_lock_addref_try (const struct lustre_handle *lockh,__u32 mode) {struct ldlm_lock *lock;int result;
@@ -832,7 +832,7 @@ void ldlm_lock_decref_internal(struct ldlm_lock *lock, __u32 mode)/** * Decrease reader/writer refcount for LDLM lock with handle \a lockh */ -void ldlm_lock_decref (struct lustre_handle *lockh,__u32 mode) +void ldlm_lock_decref (const struct lustre_handle *lockh,__u32 mode) {struct ldlm_lock *lock =__ldlm_handle2lock (lockh,0 );
@@ -849,7 +849,7 @@ EXPORT_SYMBOL(ldlm_lock_decref);* * Typical usage is for GROUP locks which we cannot allow to be cached. */ -void ldlm_lock_decref_and_cancel (struct lustre_handle *lockh,__u32 mode) +void ldlm_lock_decref_and_cancel (const struct lustre_handle *lockh,__u32 mode) {struct ldlm_lock *lock =__ldlm_handle2lock (lockh,0 );
@@ -1318,7 +1318,7 @@ enum ldlm_mode ldlm_lock_match(struct ldlm_namespace *ns, __u64 flags, }EXPORT_SYMBOL (ldlm_lock_match); -enum ldlm_mode ldlm_revalidate_lock_handle (struct lustre_handle *lockh, +enum ldlm_mode ldlm_revalidate_lock_handle (const struct lustre_handle *lockh,__u64 *bits) {struct ldlm_lock *lock;
@@ -1849,7 +1849,7 @@ EXPORT_SYMBOL(ldlm_lock_cancel);/** * Set opaque data into the lock that only makes sense to upper layer. */ -int ldlm_lock_set_data (struct lustre_handle *lockh,void *data) +int ldlm_lock_set_data (const struct lustre_handle *lockh,void *data) {struct ldlm_lock *lock =ldlm_handle2lock (lockh);int rc = -EINVAL ;
@@ -1875,7 +1875,7 @@ struct export_cl_data {* * Used when printing all locks on a resource for debug purposes. */ -void ldlm_lock_dump_handle (int level,struct lustre_handle *lockh) +void ldlm_lock_dump_handle (int level,const struct lustre_handle *lockh) {struct ldlm_lock *lock;
drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c +1 -1
@@ -499,7 +499,7 @@ static int ldlm_handle_setinfo(struct ptlrpc_request *req)static inline void ldlm_callback_errmsg (struct ptlrpc_request *req,const char *msg,int rc, -struct lustre_handle *handle) +const struct lustre_handle *handle) { DEBUG_REQ((req->rq_no_reply || rc) ? D_WARNING : D_DLMTRACE, req, "%s: [nid %s] [rc %d] [lock %#llx]",
drivers/staging/lustre/lustre/ldlm/ldlm_request.c +2 -2
@@ -336,7 +336,7 @@ int ldlm_cli_enqueue_fini(struct obd_export *exp, struct ptlrpc_request *req, enum ldlm_type type, __u8 with_policy, enum ldlm_mode mode, __u64 *flags, void *lvb, __u32 lvb_len, - struct lustre_handle *lockh, int rc) + const struct lustre_handle *lockh, int rc) { struct ldlm_namespace *ns = exp->exp_obd->obd_namespace;int is_replay = *flags &LDLM_FL_REPLAY ;
@@ -1023,7 +1023,7 @@ EXPORT_SYMBOL(ldlm_cli_update_pool);* * Lock must not have any readers or writers by this time. */ -int ldlm_cli_cancel (struct lustre_handle *lockh, +int ldlm_cli_cancel (const struct lustre_handle *lockh,enum ldlm_cancel_flags cancel_flags) {struct obd_export *exp;
Signature · 1 line
2.7.4
PATCH 19/28 staging/lustre/llite: ensure obd is effective in onu_upcall
In reply to Oleg DrokinFrom: Yang Sheng <[email protected]>
The watched obd device may still not setup while onu_upcall invoked. So we need verify it in cl_ocd_update.
Reviewed-on: http://review.whamcloud.com/19597
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8027
--- drivers/staging/lustre/lustre/llite/lcommon_misc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/staging/lustre/lustre/llite/lcommon_misc.c +5 -3
@@ -96,7 +96,8 @@ int cl_ocd_update(struct obd_device *host,__u64 flags;int result; -if (!strcmp (watched->obd_type->typ_name,LUSTRE_OSC_NAME )) { +if (!strcmp (watched->obd_type->typ_name,LUSTRE_OSC_NAME ) && + watched->obd_set_up && !watched->obd_stopping) { cli = &watched->u.cli; lco = owner; flags = cli->cl_import->imp_connect_data.ocd_connect_flags;
@@ -111,9 +112,10 @@ int cl_ocd_update(struct obd_device *host,mutex_unlock (&lco->lco_lock); result =0 ; }else { -CERROR ("unexpected notification from %s %s!\n" , +CERROR ("unexpected notification from %s %s (setup:%d,stopping:%d)!\n" , watched->obd_type->typ_name, - watched->obd_name); + watched->obd_name, watched->obd_set_up, + watched->obd_stopping); result = -EINVAL ; }return result;
Signature · 1 line
2.7.4
PATCH 20/28 staging/lustre/mdc: Zero atime in close RPC
In reply to Oleg DrokinFrom: Niu Yawei <[email protected]>
While atime on close is supposed to only increase, there's a bug in some older server versions where atime from a client is taken no matter the value that allows a stale client atime to overwrite a correct value.
Update atime in close rpc to 0 to help such servers out.
Reviewed-on: http://review.whamcloud.com/19932
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8041
--- drivers/staging/lustre/lustre/mdc/mdc_lib.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/staging/lustre/lustre/mdc/mdc_lib.c +12 -0
@@ -467,6 +467,18 @@ void mdc_close_pack(struct ptlrpc_request *req, struct md_op_data *op_data) rec =req_capsule_client_get (&req->rq_pill, &RMF_REC_REINT );mdc_setattr_pack_rec (rec, op_data); +/* +* The client will zero out local timestamps when losing the IBITS lock +* so any new RPC timestamps will update the client inode's timestamps. +* There was a defect on the server side which allowed the atime to be +* overwritten by a zeroed-out atime packed into the close RPC. +* +* Proactively clear the MDS_ATTR_ATIME flag in the RPC in this case +* to avoid zeroing the atime on old unpatched servers. See LU-8041. +*/ +if (rec->sa_atime ==0 ) + rec->sa_valid &= ~MDS_ATTR_ATIME ; +mdc_ioepoch_pack (epoch, op_data);mdc_hsm_release_pack (req, op_data); }
Signature · 1 line
2.7.4
PATCH 21/28 staging/lustre/o2ib: Don't access NULL NI on failure path
In reply to Oleg DrokinFrom: Doug Oucharek <[email protected]>
In kiblnd_passive_connect(), if we are failing the connection attempt because we cannot find a valid NI (we have a NULL NI), we were coring after the "goto fail" because the failure path was assuming non-NULL NI.
This patch ensures we don't dereference a NULL NI on that failure path.
Reviewed-on: http://review.whamcloud.com/19614
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8022
--- drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +5 -3
@@ -2525,12 +2525,14 @@ kiblnd_passive_connect(struct rdma_cm_id *cmid, void *priv, int priv_nob)return 0 ; failed: -if (ni) +if (ni) {lnet_ni_decref (ni); + rej.ibr_cp.ibcp_queue_depth = +kiblnd_msg_queue_size (version, ni); + rej.ibr_cp.ibcp_max_frags =kiblnd_rdma_frags (version, ni); + } rej.ibr_version = version; - rej.ibr_cp.ibcp_queue_depth =kiblnd_msg_queue_size (version, ni); - rej.ibr_cp.ibcp_max_frags =kiblnd_rdma_frags (version, ni);kiblnd_reject (cmid, &rej);return -ECONNREFUSED ;
Signature · 1 line
2.7.4
PATCH 22/28 staging/lustre/llite: don't panic when fid is insane
In reply to Oleg DrokinFrom: Sergey Cheremencev <[email protected]>
LASSERT should never be done on data that is received to over the network. Return EINVAL when server returns invalid fid despite of it_status == 0.
Seagate-bug-id: MRP-3073
Reviewed-on: http://review.whamcloud.com/17985
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7422
--- drivers/staging/lustre/lustre/llite/llite_lib.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/staging/lustre/lustre/llite/llite_lib.c +7 -1
@@ -1971,7 +1971,13 @@ int ll_prep_inode(struct inode **inode, struct ptlrpc_request *req,* At this point server returns to client's same fid as client * generated for creating. So using ->fid1 is okay here. */ -LASSERT (fid_is_sane (&md.body->fid1)); +if (!fid_is_sane (&md.body->fid1)) { +CERROR ("%s: Fid is insane " DFID "\n" , +ll_get_fsname (sb,NULL ,0 ), +PFID (&md.body->fid1)); + rc = -EINVAL ; + goto out; + } *inode = ll_iget(sb, cl_fid_build_ino(&md.body->fid1, sbi->ll_flags & LL_SBI_32BIT_API),
Signature · 1 line
2.7.4
PATCH 23/28 staging/lustre/llite: Restore proper opencache operations
In reply to Oleg DrokinFrom: Oleg Drokin <[email protected]>
Mark dentries that came to us via NFS in a special way so that we can tell them apart during open and activate open cache (we really don't want to do open/close RPC for every NFS IO).
This became needed since dentry revlidate no longer reimplements any RPCs for lookup, and as such if a dentry is valid, ll_revalidate_dentry returns 1 and ll_lookup_it() is never visited during opens, we get straght into ll_file_open() without a valid intent/RPC. This used to be only true for NFS, so opencache was engaged needlessly, and it carries a cost of it's own if there is in fact no repetitive file opening-closing going on
Reviewed-on: http://review.whamcloud.com/20354
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8019
--- drivers/staging/lustre/lustre/llite/file.c | 14 +++++++++++++- drivers/staging/lustre/lustre/llite/llite_internal.h | 1 + drivers/staging/lustre/lustre/llite/llite_nfs.c | 18 ++++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-)
drivers/staging/lustre/lustre/llite/file.c +13 -1
@@ -411,7 +411,19 @@ static int ll_intent_file_open(struct dentry *dentry, void *lmm,* parameters. No need for the open lock */ if (!lmm && lmmsize ==0 ) { - itp->it_flags |=MDS_OPEN_LOCK ; +struct ll_dentry_data *ldd =ll_d2d (dentry); +/* +* If we came via ll_iget_for_nfs, then we need to request +* struct ll_dentry_data *ldd = ll_d2d(file->f_dentry); +* +* NB: when ldd is NULL, it must have come via normal +* lookup path only, since ll_iget_for_nfs always calls +* ll_d_init(). +*/ +if (ldd && ldd->lld_nfs_dentry) { + ldd->lld_nfs_dentry =0 ; + itp->it_flags |=MDS_OPEN_LOCK ; + }if (itp->it_flags &FMODE_WRITE ) opc =LUSTRE_OPC_CREATE ; }
drivers/staging/lustre/lustre/llite/llite_internal.h +1 -0
@@ -64,6 +64,7 @@ struct ll_dentry_data {struct lookup_intent *lld_it;unsigned int lld_sa_generation; unsigned int lld_invalid:1; + unsigned int lld_nfs_dentry:1;struct rcu_head lld_rcu_head; };
drivers/staging/lustre/lustre/llite/llite_nfs.c +18 -0
@@ -168,6 +168,24 @@ ll_iget_for_nfs(struct super_block *sb, struct lu_fid *fid, struct lu_fid *paren/* N.B. d_obtain_alias() drops inode ref on error */ result =d_obtain_alias (inode); +if (!IS_ERR (result)) { +int rc; + + rc =ll_d_init (result); +if (rc <0 ) { +dput (result); + result =ERR_PTR (rc); + }else { +struct ll_dentry_data *ldd =ll_d2d (result); + +/* +* Need to signal to the ll_intent_file_open that +* we came from NFS and so opencache needs to be +* enabled for this one +*/ + ldd->lld_nfs_dentry =1 ; + } + }return result; }
Signature · 1 line
2.7.4
PATCH 24/28 staging/lustre/llite: ll_revalidate_dentry update
In reply to Oleg DrokinFrom: Oleg Drokin <[email protected]>
There are a couple of cases in ll_revalidate_dentry() where we are pretty sure the dentry is valid, so check for them early and save more expensive checks for later.
--- drivers/staging/lustre/lustre/llite/dcache.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/staging/lustre/lustre/llite/dcache.c +11 -0
@@ -302,6 +302,17 @@ static int ll_revalidate_dentry(struct dentry *dentry, {struct inode *dir =d_inode (dentry->d_parent); +/* If this is intermediate component path lookup and we were able to get +* to this dentry, then its lock has not been revoked and the +* path component is valid. +*/ +if (lookup_flags &LOOKUP_PARENT ) +return 1 ; + +/* Symlink - always valid as long as the dentry was found */ +if (dentry->d_inode &&S_ISLNK (dentry->d_inode->i_mode)) +return 1 ; +/* * if open&create is set, talk to MDS to make sure file is created if * necessary, because we can't do this in ->open() later since that's
Signature · 1 line
2.7.4
PATCH 25/28 staging/lustre/llite: IOC_MDC_GETFILEINFO returns the wrong ino
In reply to Oleg DrokinFrom: akam kumar bharathi <[email protected]>
req_capsule_server_get() through __req_capsule_get in ll_dir_ioctl() returns a pointer to a PTLRPC request or reply buffer, which is assigned to struct mdt_body.
If the command is IOC_MDS_GETFILEINFO then the inode "st.st_ino" should be assigned from one extracted from mdt_body through cl_fid_build_ino().
Reviewed-on: http://review.whamcloud.com/17618
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5954
--- drivers/staging/lustre/lustre/llite/dir.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/lustre/lustre/llite/dir.c +3 -1
@@ -1528,7 +1528,9 @@ skip_lmm: st.st_atime = body->atime; st.st_mtime = body->mtime; st.st_ctime = body->ctime; - st.st_ino = inode->i_ino; + st.st_ino =cl_fid_build_ino (&body->fid1, + sbi->ll_flags & +LL_SBI_32BIT_API ); lmdp = (struct lov_user_mds_data __user *)arg;if (copy_to_user (&lmdp->lmd_st, &st,sizeof (st))) {
Signature · 1 line
2.7.4
PATCH 26/28 staging/lustre/osc: fix signed one bit field
In reply to Oleg DrokinFrom: Dmitry Eremin <[email protected]>
Bit field 'oi_lockless' and 'oi_is_active' has one bit and is signed which is confusing.
Reviewed-on: http://review.whamcloud.com/19196
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7258
--- drivers/staging/lustre/lustre/osc/osc_cl_internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/osc/osc_cl_internal.h +1 -1
@@ -62,7 +62,7 @@ struct osc_io {/** super class */ struct cl_io_slice oi_cl;/** true if this io is lockless. */ -int oi_lockless; +unsigned int oi_lockless;/** how many LRU pages are reserved for this IO */ int oi_lru_reserved;
Signature · 1 line
2.7.4
PATCH 27/28 staging/lustre: Add documentation for unstable_stats in sysfs
In reply to Oleg Drokincommit ac5b14810952 ("staging: lustre: osc: Track and limit "unstable" pages") added a new sysfs variable, but corresponding bit of documentation was not forgotten.
--- drivers/staging/lustre/sysfs-fs-lustre | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/staging/lustre/sysfs-fs-lustre +8 -0
@@ -294,6 +294,14 @@ Description: Controls extended attributes client-side cache. 1 to enable, 0 to disable. +What: /sys/fs/lustre/llite/<fsname>-<uuid>/unstable_stats +Date: Apr 2016 +Contact: "Oleg Drokin" <[email protected]> +Description: + Shows number of pages that were sent and acknowledged by + server but were not yet committed and therefore still + pinned in client memory even though no longer dirty. + What: /sys/fs/lustre/ldlm/cancel_unused_locks_before_replay Date: May 2015 Contact: "Oleg Drokin" <[email protected]>
Signature · 1 line
2.7.4
PATCH 28/28 staging/lustre/osc: glimpse lock should match only with granted locks
In reply to Oleg DrokinFrom: Andriy Skulysh <[email protected]>
A deadlock is possible during ccc_prep_size()->ldlm_lock_match() vs cl_io_lock() which is waiting for a matched lock and conflicts with already taken lock before ccc_prep_size().
It is better to send an additional lock request to avoid deadlock.
Seagate-bug-id: MRP-3312
Reviewed-on: http://review.whamcloud.com/18738
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7829
--- drivers/staging/lustre/lustre/osc/osc_request.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/osc/osc_request.c +6 -2
@@ -2246,7 +2246,7 @@ int osc_enqueue_base(struct obd_export *exp, struct ldlm_res_id *res_id,struct lustre_handle lockh = {0 };struct ptlrpc_request *req =NULL ;int intent = *flags &LDLM_FL_HAS_INTENT ; -__u64 match_lvb = agl ?0 :LDLM_FL_LVB_READY ; +__u64 match_flags = *flags;enum ldlm_mode mode;int rc;
@@ -2281,7 +2281,11 @@ int osc_enqueue_base(struct obd_export *exp, struct ldlm_res_id *res_id, mode = einfo->ei_mode;if (einfo->ei_mode ==LCK_PR ) mode |=LCK_PW ; - mode =ldlm_lock_match (obd->obd_namespace, *flags | match_lvb, res_id, +if (agl ==0 ) + match_flags |=LDLM_FL_LVB_READY ; +if (intent !=0 ) + match_flags |=LDLM_FL_BLOCK_GRANTED ; + mode =ldlm_lock_match (obd->obd_namespace, match_flags, res_id, einfo->ei_type, policy, mode, &lockh,0 );if (mode) {struct ldlm_lock *matched;
Signature · 1 line
2.7.4