staging: lustre: missing fixes from lustre 2.8
cover staging: lustre: missing fixes from lustre 2.8
This patch series is a batch of fixes from the lustre 2.8 release that is missing from the upstream client. These patches are dependent on the order applied.
Alex Zhuravlev (1):
staging: lustre: llog: limit file size of plain logs
Andreas Dilger (1):
staging: lustre: llite: remove extraneous export parameter
Bobi Jam (2):
staging: lustre: llite: lower message level for ll_setattr_raw()
staging: lustre: llite: omit to update wire data
James Simmons (1):
staging: lustre: lprocfs: move lprocfs_stats_[un]lock to a source file
Jinshan Xiong (4):
staging: lustre: osc: remove obsolete asserts
staging: lustre: lov: cleanup when cl_io_iter_init() fails
staging: lustre: ldlm: handle ldlm lock cancel race when evicting client.
staging: lustre: osc: further LRU OSC cleanup after eviction
Niu Yawei (1):
staging: lustre: ldlm: fix race of starting bl threads
Vitaly Fertman (2):
staging: lustre: ldlm: reduce ldlm pool recalc window
staging: lustre: ldlm: disconnect speedup
Yang Sheng (1):
staging: lustre: lov: trying smaller memory allocations
wang di (1):
staging: lustre: llog: change lgh_hdr_lock to mutex
drivers/staging/lustre/lustre/include/cl_object.h | 13 +- .../staging/lustre/lustre/include/lprocfs_status.h | 120 ++------------ drivers/staging/lustre/lustre/include/lustre_dlm.h | 11 +- .../lustre/lustre/include/lustre_dlm_flags.h | 3 + drivers/staging/lustre/lustre/include/lustre_log.h | 2 +- .../staging/lustre/lustre/include/obd_support.h | 1 + drivers/staging/lustre/lustre/ldlm/ldlm_internal.h | 5 +- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 47 ++++-- drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 178 +++++++++++++-------- drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 7 +- drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 14 +- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 2 +- drivers/staging/lustre/lustre/llite/file.c | 49 +++--- drivers/staging/lustre/lustre/llite/glimpse.c | 4 +- drivers/staging/lustre/lustre/llite/lcommon_cl.c | 8 +- drivers/staging/lustre/lustre/llite/lcommon_misc.c | 2 +- .../staging/lustre/lustre/llite/llite_internal.h | 2 +- drivers/staging/lustre/lustre/llite/llite_lib.c | 14 +- drivers/staging/lustre/lustre/llite/llite_mmap.c | 4 +- drivers/staging/lustre/lustre/llite/lproc_llite.c | 2 +- drivers/staging/lustre/lustre/llite/rw.c | 2 +- drivers/staging/lustre/lustre/llite/vvp_dev.c | 10 +- drivers/staging/lustre/lustre/llite/vvp_io.c | 1 + drivers/staging/lustre/lustre/llite/xattr.c | 2 +- .../staging/lustre/lustre/lov/lov_cl_internal.h | 41 +++-- drivers/staging/lustre/lustre/lov/lov_io.c | 24 +-- drivers/staging/lustre/lustre/lov/lov_object.c | 2 +- drivers/staging/lustre/lustre/obdclass/cl_object.c | 6 +- drivers/staging/lustre/lustre/obdclass/llog.c | 18 ++- .../lustre/lustre/obdclass/lprocfs_status.c | 111 +++++++++++++ .../staging/lustre/lustre/obdecho/echo_client.c | 6 +- drivers/staging/lustre/lustre/osc/lproc_osc.c | 2 +- drivers/staging/lustre/lustre/osc/osc_cache.c | 3 +- .../staging/lustre/lustre/osc/osc_cl_internal.h | 4 +- drivers/staging/lustre/lustre/osc/osc_internal.h | 3 +- drivers/staging/lustre/lustre/osc/osc_io.c | 48 ++---- drivers/staging/lustre/lustre/osc/osc_lock.c | 60 ++++--- drivers/staging/lustre/lustre/osc/osc_object.c | 12 +- drivers/staging/lustre/lustre/osc/osc_page.c | 77 +++++++-- drivers/staging/lustre/lustre/osc/osc_request.c | 12 +- 40 files changed, 554 insertions(+), 378 deletions(-)
Signature · 1 line
1.8.3.1
PATCH 1/14 staging: lustre: llite: lower message level for ll_setattr_raw()
From: Bobi Jam <[email protected]>
Truncate and write can happen at the same time, so that a file can be set modified even though the file is not restored from released state, and ll_hsm_state_set() is not applicable for the file, and it will return error in this case, we'd lower the error message level in this case.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6817
Reviewed-on: http://review.whamcloud.com/15541
--- drivers/staging/lustre/lustre/llite/llite_lib.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/staging/lustre/lustre/llite/llite_lib.c +9 -1
@@ -1513,6 +1513,7 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import)*/ attr->ia_valid |=MDS_OPEN_OWNEROVERRIDE ; op_data->op_bias |=MDS_DATA_MODIFIED ; +clear_bit (LLIF_DATA_MODIFIED , &lli->lli_flags); } rc =ll_md_setattr (dentry, op_data);
@@ -1560,8 +1561,15 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import)int rc2; rc2 =ll_hsm_state_set (inode, &hss); +/* +* truncate and write can happen at the same time, so that +* the file can be set modified even though the file is not +* restored from released state, and ll_hsm_state_set() is +* not applicable for the file, and rc2 < 0 is normal in this +* case. +*/ if (rc2 <0 ) -CERROR (DFID "HSM set dirty failed: rc2 = %d\n" , +CDEBUG (D_INFO ,DFID "HSM set dirty failed: rc2 = %d\n" ,PFID (ll_inode2fid (inode)), rc2); }
Signature · 1 line
1.8.3.1
PATCH 2/14 staging: lustre: llite: omit to update wire data
In reply to James SimmonsFrom: Bobi Jam <[email protected]>
In ll_setattr_raw(), after op_data->op_attr has been copied, the attr is updated and op_data->op_attr does not get updated afterward.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6813
Reviewed-on: http://review.whamcloud.com/16462
--- drivers/staging/lustre/lustre/llite/llite_lib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/llite/llite_lib.c +2 -2
@@ -1504,8 +1504,6 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import) goto out; } - op_data->op_attr = *attr; -if (!hsm_import && attr->ia_valid &ATTR_SIZE ) {/* * If we are changing file size, file content is
@@ -1516,6 +1514,8 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import)clear_bit (LLIF_DATA_MODIFIED , &lli->lli_flags); } + op_data->op_attr = *attr; + rc =ll_md_setattr (dentry, op_data);if (rc) goto out;
Signature · 1 line
1.8.3.1
PATCH 3/14 staging: lustre: osc: remove obsolete asserts
In reply to James SimmonsFrom: Jinshan Xiong <[email protected]>
Remove the no longer needed assert in the function osc_cache_truncate_start(). The assertion in osc_object_prune() will become faulty with upcoming changes. The reason this will become a problem is that there may exist freeing pages in object's radix tree at the time of osc_object_prune(), which causes failure at the assertion of (osc->oo_npages == 0). This patch prevents that problem from happening.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6271
Reviewed-on: http://review.whamcloud.com/16456
Reviewed-on: http://review.whamcloud.com/16727
--- drivers/staging/lustre/lustre/osc/osc_cache.c | 1 - drivers/staging/lustre/lustre/osc/osc_object.c | 4 ---- 2 files changed, 5 deletions(-)
drivers/staging/lustre/lustre/osc/osc_cache.c +0 -1
@@ -2790,7 +2790,6 @@ int osc_cache_truncate_start(const struct lu_env *env, struct osc_object *obj,* We have to wait for this extent because we can't * truncate that page. */ -LASSERT (!ext->oe_hp);OSC_EXTENT_DUMP (D_CACHE , ext,"waiting for busy extent\n" ); waiting =osc_extent_get (ext);
drivers/staging/lustre/lustre/osc/osc_object.c +0 -4
@@ -200,10 +200,6 @@ static int osc_object_prune(const struct lu_env *env, struct cl_object *obj)struct osc_object *osc =cl2osc (obj);struct ldlm_res_id *resname = &osc_env_info (env)->oti_resname; -LASSERTF (osc->oo_npages ==0 , -DFID "still have %lu pages, obj: %p, osc: %p\n" , -PFID (lu_object_fid (&obj->co_lu)), osc->oo_npages, obj, osc); -/* DLM locks don't hold a reference of osc_object so we have to * clear it before the object is being destroyed. */
Signature · 1 line
1.8.3.1
PATCH 4/14 staging: lustre: lov: cleanup when cl_io_iter_init() fails
In reply to James SimmonsFrom: Jinshan Xiong <[email protected]>
In lov_io_iter_init(), if cl_io_iter_init() against sub io fails, it should call cl_io_iter_fini() to cleanup leftover information;
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6271
Reviewed-on: http://review.whamcloud.com/16456
--- drivers/staging/lustre/lustre/lov/lov_io.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-)
drivers/staging/lustre/lustre/lov/lov_io.c +13 -11
@@ -424,21 +424,23 @@ static int lov_io_iter_init(const struct lu_env *env, end =lov_offset_mod (end,1 ); sub =lov_sub_get (env, lio, stripe); -if (!IS_ERR (sub)) { -lov_io_sub_inherit (sub->sub_io, lio, stripe, - start, end); - rc =cl_io_iter_init (sub->sub_env, sub->sub_io); -lov_sub_put (sub); -CDEBUG (D_VFSTRACE ,"shrink: %d [%llu, %llu)\n" , - stripe, start, end); - }else { +if (IS_ERR (sub)) { rc =PTR_ERR (sub); +break ; } -if (!rc) -list_add_tail (&sub->sub_linkage, &lio->lis_active); -else +lov_io_sub_inherit (sub->sub_io, lio, stripe, start, end); + rc =cl_io_iter_init (sub->sub_env, sub->sub_io); +if (rc) +cl_io_iter_fini (sub->sub_env, sub->sub_io); +lov_sub_put (sub); +if (rc)break ; + +CDEBUG (D_VFSTRACE ,"shrink: %d [%llu, %llu)\n" , + stripe, start, end); + +list_add_tail (&sub->sub_linkage, &lio->lis_active); }return rc; }
Signature · 1 line
1.8.3.1
PATCH 5/14 staging: lustre: ldlm: handle ldlm lock cancel race when evicting client.
In reply to James SimmonsFrom: Jinshan Xiong <[email protected]>
A ldlm lock could be canceled simutaneously by ldlm bl thread and cleanup_resource(). In this case, only one side will win the race and the other side should wait for the work to complete. Eviction on group lock is now well supported.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6271
Reviewed-on: http://review.whamcloud.com/16456
--- drivers/staging/lustre/lustre/include/cl_object.h | 7 +++- .../lustre/lustre/include/lustre_dlm_flags.h | 3 ++ drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 46 ++++++++++++++++------ drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 14 ++++++- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 2 +- drivers/staging/lustre/lustre/llite/vvp_io.c | 1 + drivers/staging/lustre/lustre/osc/osc_lock.c | 2 + drivers/staging/lustre/lustre/osc/osc_request.c | 10 ++++- 8 files changed, 68 insertions(+), 17 deletions(-)
drivers/staging/lustre/lustre/include/cl_object.h +6 -1
@@ -1640,9 +1640,14 @@ enum cl_enq_flags {*/ CEF_PEEK =0x00000040 ,/** +* Lock match only. Used by group lock in I/O as group lock +* is known to exist. +*/ +CEF_LOCK_MATCH =BIT (7 ), +/** * mask of enq_flags. */ - CEF_MASK = 0x0000007f, + CEF_MASK = 0x000000ff, };/**
drivers/staging/lustre/lustre/include/lustre_dlm_flags.h +3 -0
@@ -121,6 +121,9 @@#define ldlm_set_test_lock (_l) LDLM_SET_FLAG((_l), 1ULL << 19)#define ldlm_clear_test_lock (_l) LDLM_CLEAR_FLAG((_l), 1ULL << 19) +/** match lock only */ +#define LDLM_FL_MATCH_LOCK 0x0000000000100000ULL/* bit 20 */ +/** * Immediately cancel such locks when they block some other locks. Send * cancel notification to original lock holder, but expect no reply. This
drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +35 -11
74 lines not on this page · raw message
drivers/staging/lustre/lustre/ldlm/ldlm_request.c +12 -2
@@ -1029,13 +1029,23 @@ int ldlm_cli_cancel(const struct lustre_handle *lockh,struct ldlm_lock *lock;LIST_HEAD (cancels); -/* concurrent cancels on the same handle can happen */ - lock =ldlm_handle2lock_long (lockh,LDLM_FL_CANCELING ); + lock =ldlm_handle2lock_long (lockh,0 );if (!lock) {LDLM_DEBUG_NOLOCK ("lock is already being destroyed" );return 0 ; } +lock_res_and_lock (lock); +/* Lock is being canceled and the caller doesn't want to wait */ +if (ldlm_is_canceling (lock) && (cancel_flags &LCF_ASYNC )) { +unlock_res_and_lock (lock); +LDLM_LOCK_RELEASE (lock); +return 0 ; + } + +ldlm_set_canceling (lock); +unlock_res_and_lock (lock); + rc =ldlm_cli_cancel_local (lock);if (rc ==LDLM_FL_LOCAL_ONLY || cancel_flags &LCF_LOCAL ) {LDLM_LOCK_RELEASE (lock);
drivers/staging/lustre/lustre/ldlm/ldlm_resource.c +1 -1
@@ -806,7 +806,7 @@ static void cleanup_resource(struct ldlm_resource *res, struct list_head *q,unlock_res (res);ldlm_lock2handle (lock, &lockh); - rc =ldlm_cli_cancel (&lockh,LCF_ASYNC ); + rc =ldlm_cli_cancel (&lockh,LCF_LOCAL );if (rc)CERROR ("ldlm_cli_cancel: %d\n" , rc);LDLM_LOCK_RELEASE (lock);
drivers/staging/lustre/lustre/llite/vvp_io.c +1 -0
@@ -219,6 +219,7 @@ static int vvp_io_one_lock_index(const struct lu_env *env, struct cl_io *io,if (vio->vui_fd && (vio->vui_fd->fd_flags &LL_FILE_GROUP_LOCKED )) { descr->cld_mode =CLM_GROUP ; descr->cld_gid = vio->vui_fd->fd_grouplock.lg_gid; + enqflags |=CEF_LOCK_MATCH ; }else { descr->cld_mode = mode; }
drivers/staging/lustre/lustre/osc/osc_lock.c +2 -0
@@ -167,6 +167,8 @@ static __u64 osc_enq2ldlm_flags(__u32 enqflags) result |=LDLM_FL_AST_DISCARD_DATA ;if (enqflags &CEF_PEEK ) result |=LDLM_FL_TEST_LOCK ; +if (enqflags &CEF_LOCK_MATCH ) + result |=LDLM_FL_MATCH_LOCK ;return result; }
drivers/staging/lustre/lustre/osc/osc_request.c +8 -2
@@ -2011,7 +2011,7 @@ int osc_enqueue_base(struct obd_export *exp, struct ldlm_res_id *res_id, } no_match: -if (*flags &LDLM_FL_TEST_LOCK ) +if (*flags & (LDLM_FL_TEST_LOCK |LDLM_FL_MATCH_LOCK ))return -ENOLCK ;if (intent) { req = ptlrpc_request_alloc(class_exp2cliimp(exp),
@@ -2495,7 +2495,13 @@ static int osc_ldlm_resource_invalidate(struct cfs_hash *hs, osc = lock->l_ast_data;cl_object_get (osc2cl (osc)); } - lock->l_ast_data =NULL ; + +/* +* clear LDLM_FL_CLEANED flag to make sure it will be canceled +* by the 2nd round of ldlm_namespace_clean() call in +* osc_import_event(). +*/ +ldlm_clear_cleaned (lock); }unlock_res (res);
Signature · 1 line
1.8.3.1
PATCH 6/14 staging: lustre: osc: further LRU OSC cleanup after eviction
In reply to James SimmonsFrom: Jinshan Xiong <[email protected]>
Define osc_lru_reserve() and osc_lru_unreserve() to reserve LRU slots in osc_io_write_iter_init() and unreserve them in fini();
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6271
Reviewed-on: http://review.whamcloud.com/16456
--- .../staging/lustre/lustre/osc/osc_cl_internal.h | 4 +- drivers/staging/lustre/lustre/osc/osc_internal.h | 3 +- drivers/staging/lustre/lustre/osc/osc_io.c | 48 +++++--------- drivers/staging/lustre/lustre/osc/osc_lock.c | 46 ++++++++------ drivers/staging/lustre/lustre/osc/osc_object.c | 8 ++- drivers/staging/lustre/lustre/osc/osc_page.c | 73 +++++++++++++++++++--- 6 files changed, 118 insertions(+), 64 deletions(-)
drivers/staging/lustre/lustre/osc/osc_cl_internal.h +3 -1
@@ -62,7 +62,9 @@ struct osc_io {/** super class */ struct cl_io_slice oi_cl;/** true if this io is lockless. */ -unsigned int oi_lockless; + unsigned int oi_lockless:1, +/** true if this io is counted as active IO */ + oi_is_active:1;/** how many LRU pages are reserved for this IO */ unsigned long oi_lru_reserved;
drivers/staging/lustre/lustre/osc/osc_internal.h +2 -1
@@ -133,7 +133,8 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli, struct list_head *ext_list, int cmd);long osc_lru_shrink (const struct lu_env *env,struct client_obd *cli,long target,bool force); -long osc_lru_reclaim (struct client_obd *cli,unsigned long npages); +unsigned long osc_lru_reserve (struct client_obd *cli,unsigned long npages); +void osc_lru_unreserve (struct client_obd *cli,unsigned long npages);unsigned long osc_ldlm_weigh_ast (struct ldlm_lock *dlmlock);
drivers/staging/lustre/lustre/osc/osc_io.c +14 -34
83 lines not on this page · raw message
drivers/staging/lustre/lustre/osc/osc_lock.c +27 -19
97 lines not on this page · raw message
drivers/staging/lustre/lustre/osc/osc_object.c +7 -1
@@ -453,9 +453,15 @@ int osc_object_invalidate(const struct lu_env *env, struct osc_object *osc)l_wait_event (osc->oo_io_waitq, !atomic_read (&osc->oo_nr_ios), &lwi); -/* Discard all pages of this object. */ +/* Discard all dirty pages of this object. */ osc_cache_truncate_start (env, osc,0 ,NULL ); +/* Discard all caching pages */ +osc_lock_discard_pages (env, osc,0 ,CL_PAGE_EOF ,CLM_WRITE ); + +/* Clear ast data of dlm lock. Do this after discarding all pages */ +osc_object_prune (env,osc2cl (osc)); +return 0 ; }
drivers/staging/lustre/lustre/osc/osc_page.c +65 -8
111 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 7/14 staging: lustre: lov: trying smaller memory allocations
In reply to James SimmonsFrom: Yang Sheng <[email protected]>
Reduce struct lov_io_sub to smaller memory usage on wide-stripe file systems.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7085
Reviewed-on: http://review.whamcloud.com/17476
--- drivers/staging/lustre/lustre/include/cl_object.h | 6 ++-- drivers/staging/lustre/lustre/llite/file.c | 16 ++++----- drivers/staging/lustre/lustre/llite/glimpse.c | 4 +-- drivers/staging/lustre/lustre/llite/lcommon_cl.c | 8 ++--- drivers/staging/lustre/lustre/llite/lcommon_misc.c | 2 +- .../staging/lustre/lustre/llite/llite_internal.h | 2 +- drivers/staging/lustre/lustre/llite/llite_mmap.c | 4 +-- drivers/staging/lustre/lustre/llite/lproc_llite.c | 2 +- drivers/staging/lustre/lustre/llite/rw.c | 2 +- drivers/staging/lustre/lustre/llite/vvp_dev.c | 10 +++--- drivers/staging/lustre/lustre/llite/xattr.c | 2 +- .../staging/lustre/lustre/lov/lov_cl_internal.h | 41 +++++++++++----------- drivers/staging/lustre/lustre/lov/lov_object.c | 2 +- drivers/staging/lustre/lustre/obdclass/cl_object.c | 6 ++-- .../staging/lustre/lustre/obdecho/echo_client.c | 6 ++-- drivers/staging/lustre/lustre/osc/lproc_osc.c | 2 +- drivers/staging/lustre/lustre/osc/osc_cache.c | 2 +- drivers/staging/lustre/lustre/osc/osc_lock.c | 12 +++---- drivers/staging/lustre/lustre/osc/osc_page.c | 4 +-- drivers/staging/lustre/lustre/osc/osc_request.c | 2 +- 20 files changed, 67 insertions(+), 68 deletions(-)
drivers/staging/lustre/lustre/include/cl_object.h +3 -3
@@ -2437,9 +2437,9 @@ void cl_sync_io_note(const struct lu_env *env, struct cl_sync_io *anchor,* @{ */ -struct lu_env *cl_env_get (int *refcheck); -struct lu_env *cl_env_alloc (int *refcheck,__u32 tags); -void cl_env_put (struct lu_env *env,int *refcheck); +struct lu_env *cl_env_get (u16 *refcheck); +struct lu_env *cl_env_alloc (u16 *refcheck,__u32 tags); +void cl_env_put (struct lu_env *env,u16 *refcheck);unsigned int cl_env_cache_purge (unsigned int nr);struct lu_env *cl_env_percpu_get (void );void cl_env_percpu_put (struct lu_env *env);
drivers/staging/lustre/lustre/llite/file.c +8 -8
@@ -1159,7 +1159,7 @@ static ssize_t ll_file_read_iter(struct kiocb *iocb, struct iov_iter *to)struct lu_env *env;struct vvp_io_args *args;ssize_t result; -int refcheck; +u16 refcheck; env =cl_env_get (&refcheck);if (IS_ERR (env))
@@ -1183,7 +1183,7 @@ static ssize_t ll_file_write_iter(struct kiocb *iocb, struct iov_iter *from)struct lu_env *env;struct vvp_io_args *args;ssize_t result; -int refcheck; +u16 refcheck; env =cl_env_get (&refcheck);if (IS_ERR (env))
@@ -1340,7 +1340,7 @@ static int ll_file_getstripe(struct inode *inode, struct lov_user_md __user *lum) {struct lu_env *env; -int refcheck; +u16 refcheck;int rc; env =cl_env_get (&refcheck);
@@ -1517,7 +1517,7 @@ static int ll_do_fiemap(struct inode *inode, struct fiemap *fiemap, {struct ll_fiemap_info_key fmkey = { .lfik_name =KEY_FIEMAP , };struct lu_env *env; -int refcheck; +u16 refcheck;int rc =0 ;/* Checks for fiemap flags */
@@ -1623,7 +1623,7 @@ int ll_data_version(struct inode *inode, __u64 *data_version, int flags)struct cl_object *obj =ll_i2info (inode)->lli_clob;struct lu_env *env;struct cl_io *io; -int refcheck; +u16 refcheck;int result;/* If no file object initialized, we consider its version is 0. */
@@ -1668,7 +1668,7 @@ int ll_hsm_release(struct inode *inode)struct obd_client_handle *och =NULL ;__u64 data_version =0 ;int rc; -int refcheck; +u16 refcheck; CDEBUG(D_INODE, "%s: Releasing file "DFID".\n", ll_get_fsname(inode->i_sb, NULL, 0),
@@ -2324,7 +2324,7 @@ int cl_sync_file_range(struct inode *inode, loff_t start, loff_t end,struct cl_io *io;struct cl_fsync_io *fio;int result; -int refcheck; +u16 refcheck;if (mode !=CL_FSYNC_NONE && mode !=CL_FSYNC_LOCAL && mode !=CL_FSYNC_DISCARD && mode !=CL_FSYNC_ALL )
@@ -3271,7 +3271,7 @@ int ll_layout_conf(struct inode *inode, const struct cl_object_conf *conf)struct cl_object *obj = lli->lli_clob;struct lu_env *env;int rc; -int refcheck; +u16 refcheck;if (!obj)return 0 ;
drivers/staging/lustre/lustre/llite/glimpse.c +2 -2
@@ -138,7 +138,7 @@ int cl_glimpse_lock(const struct lu_env *env, struct cl_io *io, }static int cl_io_get (struct inode *inode,struct lu_env **envout, -struct cl_io **ioout,int *refcheck) +struct cl_io **ioout,u16 *refcheck) {struct lu_env *env;struct cl_io *io;
@@ -178,7 +178,7 @@ int cl_glimpse_size0(struct inode *inode, int agl)struct lu_env *env =NULL ;struct cl_io *io =NULL ;int result; -int refcheck; +u16 refcheck; result =cl_io_get (inode, &env, &io, &refcheck);if (result >0 ) {
drivers/staging/lustre/lustre/llite/lcommon_cl.c +4 -4
@@ -72,7 +72,7 @@* mutex. */ struct lu_env *cl_inode_fini_env; -int cl_inode_fini_refcheck; +u16 cl_inode_fini_refcheck;/** * A mutex serializing calls to slp_inode_fini() under extreme memory
@@ -86,7 +86,7 @@ int cl_setattr_ost(struct cl_object *obj, const struct iattr *attr,struct lu_env *env;struct cl_io *io;int result; -int refcheck; +u16 refcheck; env =cl_env_get (&refcheck);if (IS_ERR (env))
@@ -149,7 +149,7 @@ int cl_file_inode_init(struct inode *inode, struct lustre_md *md) } };int result =0 ; -int refcheck; +u16 refcheck;LASSERT (md->body->mbo_valid &OBD_MD_FLID );LASSERT (S_ISREG (inode->i_mode));
@@ -237,7 +237,7 @@ void cl_inode_fini(struct inode *inode)struct lu_env *env;struct ll_inode_info *lli =ll_i2info (inode);struct cl_object *clob = lli->lli_clob; -int refcheck; +u16 refcheck;int emergency;if (clob) {
drivers/staging/lustre/lustre/llite/lcommon_misc.c +1 -1
@@ -124,7 +124,7 @@ int cl_get_grouplock(struct cl_object *obj, unsigned long gid, int nonblock,struct cl_lock *lock;struct cl_lock_descr *descr;__u32 enqflags; -int refcheck; +u16 refcheck;int rc; env =cl_env_get (&refcheck);
drivers/staging/lustre/lustre/llite/llite_internal.h +1 -1
@@ -1329,7 +1329,7 @@ int cl_setattr_ost(struct cl_object *obj, const struct iattr *attr, unsigned int attr_flags);extern struct lu_env *cl_inode_fini_env; -extern int cl_inode_fini_refcheck; +extern u16 cl_inode_fini_refcheck;int cl_file_inode_init (struct inode *inode,struct lustre_md *md);void cl_inode_fini (struct inode *inode);
drivers/staging/lustre/lustre/llite/llite_mmap.c +2 -2
@@ -150,7 +150,7 @@ static int ll_page_mkwrite0(struct vm_area_struct *vma, struct page *vmpage,struct cl_io *io;struct vvp_io *vio;int result; -int refcheck; +u16 refcheck;sigset_t set;struct inode *inode;struct ll_inode_info *lli;
@@ -268,7 +268,7 @@ static int ll_fault0(struct vm_area_struct *vma, struct vm_fault *vmf)unsigned long ra_flags;int result =0 ;int fault_ret =0 ; -int refcheck; +u16 refcheck; env =cl_env_get (&refcheck);if (IS_ERR (env))
drivers/staging/lustre/lustre/llite/lproc_llite.c +1 -1
@@ -386,7 +386,7 @@ static ssize_t ll_max_cached_mb_seq_write(struct file *file,struct lu_env *env;long diff =0 ;long nrpages =0 ; -int refcheck; +u16 refcheck;long pages_number;int mult;long rc;
drivers/staging/lustre/lustre/llite/rw.c +1 -1
@@ -905,7 +905,7 @@ int ll_writepage(struct page *vmpage, struct writeback_control *wbc)bool redirtied = false;bool unlocked = false;int result; -int refcheck; +u16 refcheck;LASSERT (PageLocked (vmpage));LASSERT (!PageWriteback (vmpage));
drivers/staging/lustre/lustre/llite/vvp_dev.c +5 -5
@@ -313,7 +313,7 @@ int cl_sb_init(struct super_block *sb)struct cl_device *cl;struct lu_env *env;int rc =0 ; -int refcheck; +u16 refcheck; sbi =ll_s2sbi (sb); env =cl_env_get (&refcheck);
@@ -336,7 +336,7 @@ int cl_sb_fini(struct super_block *sb)struct ll_sb_info *sbi;struct lu_env *env;struct cl_device *cld; -int refcheck; +u16 refcheck;int result; sbi =ll_s2sbi (sb);
@@ -535,7 +535,7 @@ static int vvp_pgcache_show(struct seq_file *f, void *v)struct cl_object *clob;struct lu_env *env;struct vvp_pgcache_id id; -int refcheck; +u16 refcheck;int result; env =cl_env_get (&refcheck);
@@ -584,7 +584,7 @@ static void *vvp_pgcache_start(struct seq_file *f, loff_t *pos) {struct ll_sb_info *sbi;struct lu_env *env; -int refcheck; +u16 refcheck; sbi = f->private;
@@ -608,7 +608,7 @@ static void *vvp_pgcache_next(struct seq_file *f, void *v, loff_t *pos) {struct ll_sb_info *sbi;struct lu_env *env; -int refcheck; +u16 refcheck; env =cl_env_get (&refcheck);if (!IS_ERR (env)) {
drivers/staging/lustre/lustre/llite/xattr.c +1 -1
@@ -427,7 +427,7 @@ static ssize_t ll_getxattr_lov(struct inode *inode, void *buf, size_t buf_size) .cl_buf.lb_len = buf_size, };struct lu_env *env; -int refcheck; +u16 refcheck;if (!obj)return -ENODATA ;
drivers/staging/lustre/lustre/lov/lov_cl_internal.h +20 -21
67 lines not on this page · raw message
drivers/staging/lustre/lustre/lov/lov_object.c +1 -1
@@ -746,7 +746,7 @@ static int lov_layout_change(const struct lu_env *unused,const struct lov_layout_operations *old_ops;const struct lov_layout_operations *new_ops;struct lu_env *env; -int refcheck; +u16 refcheck;int rc;LASSERT (0 <= lov->lo_type && lov->lo_type <ARRAY_SIZE (lov_dispatch));
drivers/staging/lustre/lustre/obdclass/cl_object.c +3 -3
@@ -688,7 +688,7 @@ static inline struct cl_env *cl_env_container(struct lu_env *env)* * \see cl_env_put() */ -struct lu_env *cl_env_get (int *refcheck) +struct lu_env *cl_env_get (u16 *refcheck) {struct lu_env *env;
@@ -709,7 +709,7 @@ struct lu_env *cl_env_get(int *refcheck)* * \see cl_env_get() */ -struct lu_env *cl_env_alloc (int *refcheck,__u32 tags) +struct lu_env *cl_env_alloc (u16 *refcheck,u32 tags) {struct lu_env *env;
@@ -769,7 +769,7 @@ unsigned int cl_env_cache_purge(unsigned int nr)* this thread is using environment and it is returned to the allocation * cache, or freed straight away, if cache is large enough. */ -void cl_env_put (struct lu_env *env,int *refcheck) +void cl_env_put (struct lu_env *env,u16 *refcheck) {struct cl_env *cle;
drivers/staging/lustre/lustre/obdecho/echo_client.c +3 -3
@@ -816,7 +816,7 @@ static struct lu_device *echo_device_free(const struct lu_env *env,struct echo_object *eco;struct cl_object *obj;struct lu_fid *fid; -int refcheck; +u16 refcheck;int rc;LASSERTF (ostid_id (oi),DOSTID "\n" ,POSTID (oi));
@@ -882,7 +882,7 @@ static int cl_echo_object_put(struct echo_object *eco) {struct lu_env *env;struct cl_object *obj =echo_obj2cl (eco); -int refcheck; +u16 refcheck; env =cl_env_get (&refcheck);if (IS_ERR (env))
@@ -999,7 +999,7 @@ static int cl_echo_object_brw(struct echo_object *eco, int rw, u64 offset,struct cl_page *clp;struct lustre_handle lh = {0 };size_t page_size =cl_page_size (obj); -int refcheck; +u16 refcheck;int rc;int i;
drivers/staging/lustre/lustre/osc/lproc_osc.c +1 -1
@@ -229,7 +229,7 @@ static ssize_t osc_cached_mb_seq_write(struct file *file, rc =atomic_long_read (&cli->cl_lru_in_list) - pages_number;if (rc >0 ) {struct lu_env *env; -int refcheck; +u16 refcheck; env =cl_env_get (&refcheck);if (!IS_ERR (env)) {
drivers/staging/lustre/lustre/osc/osc_cache.c +1 -1
@@ -988,7 +988,7 @@ static int osc_extent_truncate(struct osc_extent *ext, pgoff_t trunc_index,int grants =0 ;int nr_pages =0 ;int rc =0 ; -int refcheck; +u16 refcheck;LASSERT (sanity_check (ext) ==0 );EASSERT (ext->oe_state ==OES_TRUNC , ext);
drivers/staging/lustre/lustre/osc/osc_lock.c +6 -6
@@ -297,7 +297,7 @@ static int osc_lock_upcall(void *cookie, struct lustre_handle *lockh,struct cl_lock_slice *slice = &oscl->ols_cl;struct lu_env *env;int rc; -int refcheck; +u16 refcheck; env =cl_env_get (&refcheck);/* should never happen, similar to osc_ldlm_blocking_ast(). */
@@ -349,7 +349,7 @@ static int osc_lock_upcall_agl(void *cookie, struct lustre_handle *lockh,struct osc_object *osc = cookie;struct ldlm_lock *dlmlock;struct lu_env *env; -int refcheck; +u16 refcheck; env =cl_env_get (&refcheck);LASSERT (!IS_ERR (env));
@@ -384,7 +384,7 @@ static int osc_lock_flush(struct osc_object *obj, pgoff_t start, pgoff_t end, enum cl_lock_mode mode, int discard) {struct lu_env *env; -int refcheck; +u16 refcheck;int rc =0 ;int rc2 =0 ;
@@ -538,7 +538,7 @@ static int osc_ldlm_blocking_ast(struct ldlm_lock *dlmlock, }case LDLM_CB_CANCELING : {struct lu_env *env; -int refcheck; +u16 refcheck;/* * This can be called in the context of outer IO, e.g.,
@@ -575,7 +575,7 @@ static int osc_ldlm_glimpse_ast(struct ldlm_lock *dlmlock, void *data)struct req_capsule *cap;struct cl_object *obj =NULL ;int result; -int refcheck; +u16 refcheck;LASSERT (lustre_msg_get_opc (req->rq_reqmsg) ==LDLM_GL_CALLBACK );
@@ -686,7 +686,7 @@ unsigned long osc_ldlm_weigh_ast(struct ldlm_lock *dlmlock)struct osc_lock *oscl;unsigned long weight;bool found = false; -int refcheck; +u16 refcheck;might_sleep ();/*
drivers/staging/lustre/lustre/osc/osc_page.c +2 -2
@@ -681,7 +681,7 @@ static long osc_lru_reclaim(struct client_obd *cli, unsigned long npages)struct lu_env *env;struct cl_client_cache *cache = cli->cl_cache;int max_scans; -int refcheck; +u16 refcheck;long rc =0 ;LASSERT (cache);
@@ -1045,7 +1045,7 @@ unsigned long osc_cache_shrink_scan(struct shrinker *sk,struct client_obd *cli;struct lu_env *env;long shrank =0 ; -int refcheck; +u16 refcheck;int rc;if (!sc->nr_to_scan)
drivers/staging/lustre/lustre/osc/osc_request.c +1 -1
@@ -2538,7 +2538,7 @@ static int osc_import_event(struct obd_device *obd,case IMP_EVENT_INVALIDATE : {struct ldlm_namespace *ns = obd->obd_namespace;struct lu_env *env; -int refcheck; +u16 refcheck;ldlm_namespace_cleanup (ns,LDLM_FL_LOCAL_ONLY );
Signature · 1 line
1.8.3.1
PATCH 8/14 staging: lustre: llite: remove extraneous export parameter
In reply to James SimmonsFrom: Andreas Dilger <[email protected]>
The ll_close_inode_openhandle() and ll_md_close() functions passed an extra "obd_export *md_exp" parameter, but it turns out that all of the callers already pass inode->i_sb->s_fs_info->lsi_llsbi->ll_md_exp in one form or another, so it can just be extracted from "inode" directly as needed.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6627
Reviewed-on: http://review.whamcloud.com/14953
--- drivers/staging/lustre/lustre/llite/file.c | 33 +++++++++++++----------------- 1 file changed, 14 insertions(+), 19 deletions(-)
drivers/staging/lustre/lustre/llite/file.c +14 -19
@@ -116,13 +116,13 @@ static void ll_prepare_close(struct inode *inode, struct md_op_data *op_data,* If \a bias is MDS_CLOSE_LAYOUT_SWAP then \a data is a pointer to the inode to * swap layouts with. */ -static int ll_close_inode_openhandle (struct obd_export *md_exp, +static int ll_close_inode_openhandle (struct inode *inode,struct obd_client_handle *och, -struct inode *inode,enum mds_op_bias bias,void *data) {const struct ll_inode_info *lli =ll_i2info (inode); +struct obd_export *md_exp =ll_i2mdexp (inode);struct md_op_data *op_data;struct ptlrpc_request *req =NULL ;int rc;
@@ -231,15 +231,13 @@ int ll_md_real_close(struct inode *inode, fmode_t fmode)/* There might be a race and this handle may already * be closed. */ - rc =ll_close_inode_openhandle (ll_i2sbi (inode)->ll_md_exp, - och, inode,0 ,NULL ); + rc =ll_close_inode_openhandle (inode, och,0 ,NULL ); }return rc; } -static int ll_md_close (struct obd_export *md_exp,struct inode *inode, -struct file *file) +static int ll_md_close (struct inode *inode,struct file *file) {struct ll_file_data *fd =LUSTRE_FPRIVATE (file);struct ll_inode_info *lli =ll_i2info (inode);
@@ -270,8 +268,7 @@ static int ll_md_close(struct obd_export *md_exp, struct inode *inode, }if (fd->fd_och) { - rc =ll_close_inode_openhandle (md_exp, fd->fd_och, inode,0 , -NULL ); + rc =ll_close_inode_openhandle (inode, fd->fd_och,0 ,NULL ); fd->fd_och =NULL ; goto out; }
@@ -296,7 +293,7 @@ static int ll_md_close(struct obd_export *md_exp, struct inode *inode, }mutex_unlock (&lli->lli_och_mutex); -if (!md_lock_match (md_exp, flags,ll_inode2fid (inode), +if (!md_lock_match (ll_i2mdexp (inode), flags,ll_inode2fid (inode),LDLM_IBITS , &policy, lockmode, &lockh)) rc =ll_md_real_close (inode, fd->fd_omode);
@@ -345,7 +342,7 @@ int ll_file_release(struct inode *inode, struct file *file) lli->lli_async_rc =0 ; } - rc =ll_md_close (sbi->ll_md_exp, inode, file); + rc =ll_md_close (inode, file);if (CFS_FAIL_TIMEOUT_MS (OBD_FAIL_PTLRPC_DUMP_LOG , cfs_fail_val))libcfs_debug_dumplog ();
@@ -835,7 +832,7 @@ static int ll_md_blocking_lease_ast(struct ldlm_lock *lock, it.it_lock_mode =0 ; och->och_lease_handle.cookie =0ULL ; } - rc2 =ll_close_inode_openhandle (sbi->ll_md_exp, och, inode,0 ,NULL ); + rc2 =ll_close_inode_openhandle (inode, och,0 ,NULL );if (rc2 <0 ) CERROR("%s: error closing file "DFID": %d\n", ll_get_fsname(inode->i_sb, NULL, 0),
@@ -901,8 +898,8 @@ static int ll_swap_layouts_close(struct obd_client_handle *och,* NB: lease lock handle is released in mdc_close_layout_swap_pack() * because we still need it to pack l_remote_handle to MDT. */ - rc =ll_close_inode_openhandle (ll_i2sbi (inode)->ll_md_exp, och, inode, -MDS_CLOSE_LAYOUT_SWAP , inode2); + rc =ll_close_inode_openhandle (inode, och,MDS_CLOSE_LAYOUT_SWAP , + inode2); och =NULL ;/* freed in ll_close_inode_openhandle() */
@@ -937,8 +934,7 @@ static int ll_lease_close(struct obd_client_handle *och, struct inode *inode,if (lease_broken) *lease_broken = cancelled; -return ll_close_inode_openhandle (ll_i2sbi (inode)->ll_md_exp, - och, inode,0 ,NULL ); +return ll_close_inode_openhandle (inode, och,0 ,NULL ); }int ll_merge_attr (const struct lu_env *env,struct inode *inode)
@@ -1494,8 +1490,7 @@ int ll_release_openhandle(struct inode *inode, struct lookup_intent *it)ll_och_fill (ll_i2sbi (inode)->ll_md_exp, it, och); - rc =ll_close_inode_openhandle (ll_i2sbi (inode)->ll_md_exp, - och, inode,0 ,NULL ); + rc =ll_close_inode_openhandle (inode, och,0 ,NULL ); out:/* this one is in place of ll_file_open */ if (it_disposition (it,DISP_ENQ_OPEN_REF )) {
@@ -1698,8 +1693,8 @@ int ll_hsm_release(struct inode *inode)* NB: lease lock handle is released in mdc_hsm_release_pack() because * we still need it to pack l_remote_handle to MDT. */ - rc =ll_close_inode_openhandle (ll_i2sbi (inode)->ll_md_exp, och, inode, -MDS_HSM_RELEASE , &data_version); + rc =ll_close_inode_openhandle (inode, och,MDS_HSM_RELEASE , + &data_version); och =NULL ; out:
Signature · 1 line
1.8.3.1
PATCH 9/14 staging: lustre: ldlm: reduce ldlm pool recalc window
In reply to James SimmonsFrom: Vitaly Fertman <[email protected]>
Reduce the sleep period from 50 seconds down to LDLM_POOL_CLI_DEF_RECALC_PERIOD which is 10 seconds.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3031
Xyratex-bug-id: MRP-395 MRP-1366 MRP-1366
Reviewed-on: http://review.whamcloud.com/5843
--- drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +2 -1
@@ -900,8 +900,9 @@ static int ldlm_pools_recalc(enum ldlm_side client) {struct ldlm_namespace *ns;struct ldlm_namespace *ns_old =NULL ; +/* seconds of sleep if no active namespaces */ +int time =LDLM_POOL_CLI_DEF_RECALC_PERIOD ;int nr; -int time =50 ;/* seconds of sleep if no active namespaces */ /* * Recalc at least ldlm_namespace_nr_read(client) namespaces.
Signature · 1 line
1.8.3.1
PATCH 10/14 staging: lustre: ldlm: disconnect speedup
In reply to James SimmonsFrom: Vitaly Fertman <[email protected]>
disconnect takes too long time if there are many locks to cancel. besides the amount of time spent on each lock cancel, there is a resched() in cfs_hash_for_each_relax(), i.e. disconnect or eviction may take unexpectedly long time. While this patch only contains the client side fixes the original fix covered changes to both the server and client code to ensure proper disconnect handling. Below details the change done on both the server and client so people can examine the disconnect behavior with both source bases.
- do not cancel locks on disconnect_export;
- export will be left in obd_unlinked_exports list pinned by live locks;
- new re-connects will created other non-conflicting exports;
- new locks will cancel obsolete locks on conflicts;
- once all the locks on the disconnected export will be cancelled, the export will be destroyed on the last ref put;
- do not cancel in small portions, cancel all together in just 1 dedicated thread - use server side blocking thread for that;
- cancel blocked locks first so that waiting locks could proceed;
- take care about blocked waiting locks, so that they would get cancelled quickly too;
- do not remove lock from waiting list on AST error before moving it to elt_expired_locks list, because it removes it from export list too; otherwise this blocked lock will not be cancelled immediately on failed export;
- cancel lock instead of just destroy for failed export, to make full cleanup, i.e. remove it from export list.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3031
Xyratex-bug-id: MRP-395 MRP-1366 MRP-1366
Reviewed-on: http://review.whamcloud.com/5843
--- drivers/staging/lustre/lustre/include/lustre_dlm.h | 11 +- .../staging/lustre/lustre/include/obd_support.h | 1 + drivers/staging/lustre/lustre/ldlm/ldlm_internal.h | 5 +- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 1 - drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 143 +++++++++++++-------- drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 4 + 6 files changed, 101 insertions(+), 64 deletions(-)
drivers/staging/lustre/lustre/include/lustre_dlm.h +4 -7
@@ -812,13 +812,6 @@ struct ldlm_lock {/** referenced export object */ struct obd_export *l_exp_refs_target;#endif -/** -* export blocking dlm lock list, protected by -* l_export->exp_bl_list_lock. -* Lock order of waiting_lists_spinlock, exp_bl_list_lock and res lock -* is: res lock -> exp_bl_list_lock -> wanting_lists_spinlock. -*/ -struct list_head l_exp_list; };/**
@@ -1192,6 +1185,10 @@ struct ldlm_namespace * enum ldlm_side client, enum ldlm_appetite apt, enum ldlm_ns_type ns_type);int ldlm_namespace_cleanup (struct ldlm_namespace *ns,__u64 flags); +void ldlm_namespace_free_prior (struct ldlm_namespace *ns, +struct obd_import *imp, +int force); +void ldlm_namespace_free_post (struct ldlm_namespace *ns);void ldlm_namespace_get (struct ldlm_namespace *ns);void ldlm_namespace_put (struct ldlm_namespace *ns);int ldlm_debugfs_setup (void );
drivers/staging/lustre/lustre/include/obd_support.h +1 -0
@@ -316,6 +316,7 @@#define OBD_FAIL_LDLM_AGL_NOLOCK 0x31b#define OBD_FAIL_LDLM_OST_LVB 0x31c#define OBD_FAIL_LDLM_ENQUEUE_HANG 0x31d +#define OBD_FAIL_LDLM_PAUSE_CANCEL2 0x31f#define OBD_FAIL_LDLM_CP_CB_WAIT2 0x320#define OBD_FAIL_LDLM_CP_CB_WAIT3 0x321#define OBD_FAIL_LDLM_CP_CB_WAIT4 0x322
drivers/staging/lustre/lustre/ldlm/ldlm_internal.h +2 -3
@@ -108,9 +108,7 @@ int ldlm_cancel_lru_local(struct ldlm_namespace *ns,/* ldlm_resource.c */ int ldlm_resource_putref_locked (struct ldlm_resource *res); -void ldlm_namespace_free_prior (struct ldlm_namespace *ns, -struct obd_import *imp,int force); -void ldlm_namespace_free_post (struct ldlm_namespace *ns); +/* ldlm_lock.c */ struct ldlm_cb_set_arg {
@@ -156,6 +154,7 @@ int ldlm_bl_to_thread_list(struct ldlm_namespace *ns,struct ldlm_lock_desc *ld, struct list_head *cancels, int count, enum ldlm_cancel_flags cancel_flags); +int ldlm_bl_thread_wakeup (void );void ldlm_handle_bl_callback (struct ldlm_namespace *ns,struct ldlm_lock_desc *ld,struct ldlm_lock *lock);
drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +0 -1
@@ -435,7 +435,6 @@ static struct ldlm_lock *ldlm_lock_new(struct ldlm_resource *resource) lock->l_exp_refs_nr =0 ; lock->l_exp_refs_target =NULL ;#endif -INIT_LIST_HEAD (&lock->l_exp_list);return lock; }
drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c +90 -53
196 lines not on this page · raw message
drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +4 -0
@@ -975,6 +975,10 @@ static int ldlm_pools_recalc(enum ldlm_side client)ldlm_namespace_put (ns); } } + +/* Wake up the blocking threads from time to time. */ +ldlm_bl_thread_wakeup (); +return time; }
Signature · 1 line
1.8.3.1
PATCH 11/14 staging: lustre: ldlm: fix race of starting bl threads
In reply to James SimmonsFrom: Niu Yawei <[email protected]>
There is race in the code of starting bl threads which leads to thread number exceeds the maximum number when race happened, it can also lead to duplicated thread name. This patch fixes the race and cleanup the code a bit.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7330
Reviewed-on: http://review.whamcloud.com/17026
--- drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 49 ++++++++++++++----------- 1 file changed, 28 insertions(+), 21 deletions(-)
drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c +28 -21
@@ -714,7 +714,6 @@ static int ldlm_bl_get_work(struct ldlm_bl_pool *blp,/* This only contains temporary data until the thread starts */ struct ldlm_bl_thread_data { -char bltd_name[CFS_CURPROC_COMM_MAX ];struct ldlm_bl_pool *bltd_blp;struct completion bltd_comp;int bltd_num;
@@ -722,19 +721,32 @@ struct ldlm_bl_thread_data {static int ldlm_bl_thread_main (void *arg); -static int ldlm_bl_thread_start (struct ldlm_bl_pool *blp) +static int ldlm_bl_thread_start (struct ldlm_bl_pool *blp,bool check_busy) {struct ldlm_bl_thread_data bltd = { .bltd_blp = blp };struct task_struct *task;init_completion (&bltd.bltd_comp); - bltd.bltd_num =atomic_read (&blp->blp_num_threads); -snprintf (bltd.bltd_name,sizeof (bltd.bltd_name), -"ldlm_bl_%02d" , bltd.bltd_num); - task =kthread_run (ldlm_bl_thread_main, &bltd,"%s" , bltd.bltd_name); + + bltd.bltd_num =atomic_inc_return (&blp->blp_num_threads); +if (bltd.bltd_num >= blp->blp_max_threads) { +atomic_dec (&blp->blp_num_threads); +return 0 ; + } + +LASSERTF (bltd.bltd_num >0 ,"thread num:%d\n" , bltd.bltd_num); +if (check_busy && +atomic_read (&blp->blp_busy_threads) < (bltd.bltd_num -1 )) { +atomic_dec (&blp->blp_num_threads); +return 0 ; + } + + task =kthread_run (ldlm_bl_thread_main, &bltd,"ldlm_bl_%02d" , + bltd.bltd_num);if (IS_ERR (task)) {CERROR ("cannot start LDLM thread ldlm_bl_%02d: rc %ld\n" , -atomic_read (&blp->blp_num_threads),PTR_ERR (task)); + bltd.bltd_num,PTR_ERR (task)); +atomic_dec (&blp->blp_num_threads);return PTR_ERR (task); }wait_for_completion (&bltd.bltd_comp);
@@ -746,12 +758,11 @@ static int ldlm_bl_thread_start(struct ldlm_bl_pool *blp)static int ldlm_bl_thread_need_create (struct ldlm_bl_pool *blp,struct ldlm_bl_work_item *blwi) { -int busy =atomic_read (&blp->blp_busy_threads); - -if (busy >= blp->blp_max_threads) +if (atomic_read (&blp->blp_num_threads) >= blp->blp_max_threads)return 0 ; -if (busy <atomic_read (&blp->blp_num_threads)) +if (atomic_read (&blp->blp_busy_threads) < +atomic_read (&blp->blp_num_threads))return 0 ;if (blwi && (!blwi->blwi_ns || blwi->blwi_mem_pressure))
@@ -815,9 +826,6 @@ static int ldlm_bl_thread_main(void *arg) blp = bltd->bltd_blp; -atomic_inc (&blp->blp_num_threads); -atomic_inc (&blp->blp_busy_threads); -complete (&bltd->bltd_comp);/* cannot use bltd after this, it is only on caller's stack */
@@ -828,27 +836,26 @@ static int ldlm_bl_thread_main(void *arg)int rc; rc =ldlm_bl_get_work (blp, &blwi, &exp); -if (!rc) { -atomic_dec (&blp->blp_busy_threads); +if (!rc)l_wait_event_exclusive (blp->blp_waitq,ldlm_bl_get_work (blp, &blwi, &exp), &lwi); -atomic_inc (&blp->blp_busy_threads); - } +atomic_inc (&blp->blp_busy_threads);if (ldlm_bl_thread_need_create (blp, blwi))/* discard the return value, we tried */ -ldlm_bl_thread_start (blp); +ldlm_bl_thread_start (blp, true);if (blwi) rc =ldlm_bl_thread_blwi (blp, blwi); +atomic_dec (&blp->blp_busy_threads); +if (rc ==LDLM_ITER_STOP )break ; } -atomic_dec (&blp->blp_busy_threads);atomic_dec (&blp->blp_num_threads);complete (&blp->blp_comp);return 0 ;
@@ -1028,7 +1035,7 @@ static int ldlm_setup(void) }for (i =0 ; i < blp->blp_min_threads; i++) { - rc =ldlm_bl_thread_start (blp); + rc =ldlm_bl_thread_start (blp, false);if (rc <0 ) goto out; }
Signature · 1 line
1.8.3.1
PATCH 12/14 staging: lustre: llog: change lgh_hdr_lock to mutex
In reply to James SimmonsFrom: wang di <[email protected]>
Change lgh_hdr_lock from spinlock to mutex because if the llog object is a remote object it can be stalled while being fetched.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6602
Reviewed-on: http://review.whamcloud.com/15274
--- drivers/staging/lustre/lustre/include/lustre_log.h | 2 +- drivers/staging/lustre/lustre/obdclass/llog.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/include/lustre_log.h +1 -1
@@ -211,7 +211,7 @@ struct llog_operations {/* In-memory descriptor for a log object or log catalog */ struct llog_handle {struct rw_semaphore lgh_lock; -spinlock_t lgh_hdr_lock;/* protect lgh_hdr data */ +struct mutex lgh_hdr_mutex;/* protect lgh_hdr data */ struct llog_logid lgh_id;/* id of this log */ struct llog_log_hdr *lgh_hdr;size_t lgh_hdr_size;
drivers/staging/lustre/lustre/obdclass/llog.c +1 -1
@@ -61,7 +61,7 @@ static struct llog_handle *llog_alloc_handle(void)return NULL ;init_rwsem (&loghandle->lgh_lock); -spin_lock_init (&loghandle->lgh_hdr_lock); +mutex_init (&loghandle->lgh_hdr_mutex);INIT_LIST_HEAD (&loghandle->u.phd.phd_entry);atomic_set (&loghandle->lgh_refcount,1 );
Signature · 1 line
1.8.3.1
Greg Kroah-Hartman
maintainerRe: [PATCH 12/14] staging: lustre: llog: change lgh_hdr_lock to mutex
Quoted 5 lines · James Simmons
From: wang di <[email protected]>
Change
lgh_hdr_lockfrom spinlock to mutex because if the llog object is a remote object it can be stalled while being fetched.
but this lock is never even used! Why have it at all?
Quoted 31 lines
Signed-off-by wang di <[email protected]>Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6602
Reviewed-on: http://review.whamcloud.com/15274Reviewed-by James Simmons <[email protected]>Reviewed-by Lai Siyao <[email protected]>Reviewed-by Oleg Drokin <[email protected]>Signed-off-by James Simmons <[email protected]>--- drivers/staging/lustre/lustre/include/lustre_log.h | 2 +- drivers/staging/lustre/lustre/obdclass/llog.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)drivers/staging/lustre/lustre/include/lustre_log.h +1
-1@@ -211,7 +211,7 @@ struct llog_operations {/* In-memory descriptor for a log object or log catalog */ struct llog_handle {struct rw_semaphore lgh_lock; -spinlock_t lgh_hdr_lock;/* protect lgh_hdr data */ +struct mutex lgh_hdr_mutex;/* protect lgh_hdr data */ struct llog_logid lgh_id;/* id of this log */ struct llog_log_hdr *lgh_hdr;size_t lgh_hdr_size;drivers/staging/lustre/lustre/obdclass/llog.c +0
-0
drivers/staging/lustre/lustre/obdclass/llog.c static struct llog_handle *llog_alloc_handle(void) · line 64
Quoted 5 lines
drivers/staging/lustre/lustre/obdclass/llog.c +1
-1@@ -61,7 +61,7 @@ static struct llog_handle *llog_alloc_handle(void)return NULL ;init_rwsem (&loghandle->lgh_lock); -spin_lock_init (&loghandle->lgh_hdr_lock); +mutex_init (&loghandle->lgh_hdr_mutex);
Can't we delete it?
thanks,
greg k-h
PATCH 13/14 staging: lustre: llog: limit file size of plain logs
In reply to James SimmonsFrom: Alex Zhuravlev <[email protected]>
on small filesystems plain log can grow dramatically. especially given large record sizes produced by DNE and extended chunksize. I saw >50% of space consumed by a single llog file which was still in use. this leads to test failures (sanityn, etc).
the patch introduces additional limit on plain llog size, which is calculated as <free space>/64 (128MB at most) at llog creation time.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6838
Reviewed-on: https://review.whamcloud.com/18028
--- drivers/staging/lustre/lustre/obdclass/llog.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/staging/lustre/lustre/obdclass/llog.c +16 -0
@@ -319,10 +319,26 @@ static int llog_process_thread(void *arg)* the case and re-read the current chunk * otherwise. */ +int records; +if (index > loghandle->lgh_last_idx) { rc =0 ; goto out; } +/* <2 records means no more records +* if the last record we processed was +* the final one, then the underlying +* object might have been destroyed yet. +* we better don't access that.. +*/ +mutex_lock (&loghandle->lgh_hdr_mutex); + records = loghandle->lgh_hdr->llh_count; +mutex_unlock (&loghandle->lgh_hdr_mutex); +if (records <=1 ) { + rc =0 ; + goto out; + } +CDEBUG (D_OTHER ,"Re-read last llog buffer for new records, index %u, last %u\n" , index, loghandle->lgh_last_idx);/* save offset inside buffer for the re-read */
Signature · 1 line
1.8.3.1
Greg Kroah-Hartman
maintainerRe: [PATCH 13/14] staging: lustre: llog: limit file size of plain logs
Quoted 39 lines · James Simmons
From: Alex Zhuravlev <[email protected]>
on small filesystems plain log can grow dramatically. especially given large record sizes produced by DNE and extended chunksize. I saw >50% of space consumed by a single llog file which was still in use. this leads to test failures (sanityn, etc).
the patch introduces additional limit on plain llog size, which is calculated as <free space>/64 (128MB at most) at llog creation time.Signed-off-by Alex Zhuravlev <[email protected]>Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6838
Reviewed-on: https://review.whamcloud.com/18028Reviewed-by Andreas Dilger <[email protected]>Reviewed-by wangdi <[email protected]>Reviewed-by Mike Pershin <[email protected]>Reviewed-by Oleg Drokin <[email protected]>Signed-off-by James Simmons <[email protected]>--- drivers/staging/lustre/lustre/obdclass/llog.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)drivers/staging/lustre/lustre/obdclass/llog.c +5
-0@@ -319,10 +319,26 @@ static int llog_process_thread(void *arg)* the case and re-read the current chunk * otherwise. */ +int records; +if (index > loghandle->lgh_last_idx) { rc =0 ; goto out; } +/* <2 records means no more records +* if the last record we processed was +* the final one, then the underlying
drivers/staging/lustre/lustre/obdclass/llog.c static int llog_process_thread(void *arg) · line 340
Quoted 10 lines
drivers/staging/lustre/lustre/obdclass/llog.c +10
-0+* object might have been destroyed yet. +* we better don't access that.. +*/ +mutex_lock (&loghandle->lgh_hdr_mutex); + records = loghandle->lgh_hdr->llh_count; +mutex_unlock (&loghandle->lgh_hdr_mutex); +if (records <=1 ) { + rc =0 ; + goto out; + }
So you now use the lock, in only one place, when reading a single value? That makes no sense, it's obviously wrong, or not needed.
Please fix up these two patches...
thanks,
greg k-h
Re: [PATCH 13/14] staging: lustre: llog: limit file size of plain logs
Quoted 55 lines · Greg Kroah-Hartman
Quoted 39 lines · James Simmons
From: Alex Zhuravlev <[email protected]>
on small filesystems plain log can grow dramatically. especially given large record sizes produced by DNE and extended chunksize. I saw >50% of space consumed by a single llog file which was still in use. this leads to test failures (sanityn, etc).
the patch introduces additional limit on plain llog size, which is calculated as <free space>/64 (128MB at most) at llog creation time.Signed-off-by Alex Zhuravlev <[email protected]>Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6838
Reviewed-on: https://review.whamcloud.com/18028Reviewed-by Andreas Dilger <[email protected]>Reviewed-by wangdi <[email protected]>Reviewed-by Mike Pershin <[email protected]>Reviewed-by Oleg Drokin <[email protected]>Signed-off-by James Simmons <[email protected]>---
drivers/staging/lustre/lustre/obdclass/llog.c| 16 ++++++++++++++++1 file changed, 16 insertions(+)drivers/staging/lustre/lustre/obdclass/llog.c +5
-0@@ -319,10 +319,26 @@ static int llog_process_thread(void *arg)* the case and re-read the current chunk * otherwise. */ +int records; +if (index > loghandle->lgh_last_idx) { rc =0 ; goto out; } +/* <2 records means no more records +* if the last record we processed was +* the final one, then the underlying drivers/staging/lustre/lustre/obdclass/llog.c static int llog_process_thread(void *arg) · line 340
Quoted 10 lines
drivers/staging/lustre/lustre/obdclass/llog.c +10
-0+* object might have been destroyed yet. +* we better don't access that.. +*/ +mutex_lock (&loghandle->lgh_hdr_mutex); + records = loghandle->lgh_hdr->llh_count; +mutex_unlock (&loghandle->lgh_hdr_mutex); +if (records <=1 ) { + rc =0 ; + goto out; + }So you now use the lock, in only one place, when reading a single value? That makes no sense, it's obviously wrong, or not needed.
Quoted 1 line
Please fix up these two patches?
Ah, this is in fact server-side fix, so all the other users were in the parts not really present in the client.
James, we don't really need this patch in the client, I guess.
Re: [PATCH 13/14] staging: lustre: llog: limit file size of plain logs
In reply to Greg Kroah-HartmanQuoted 55 lines · Greg Kroah-Hartman
Quoted 39 lines · James Simmons
From: Alex Zhuravlev <[email protected]>
on small filesystems plain log can grow dramatically. especially given large record sizes produced by DNE and extended chunksize. I saw >50% of space consumed by a single llog file which was still in use. this leads to test failures (sanityn, etc).
the patch introduces additional limit on plain llog size, which is calculated as <free space>/64 (128MB at most) at llog creation time.Signed-off-by Alex Zhuravlev <[email protected]>Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6838
Reviewed-on: https://review.whamcloud.com/18028Reviewed-by Andreas Dilger <[email protected]>Reviewed-by wangdi <[email protected]>Reviewed-by Mike Pershin <[email protected]>Reviewed-by Oleg Drokin <[email protected]>Signed-off-by James Simmons <[email protected]>---
drivers/staging/lustre/lustre/obdclass/llog.c| 16 ++++++++++++++++1 file changed, 16 insertions(+)drivers/staging/lustre/lustre/obdclass/llog.c +5
-0@@ -319,10 +319,26 @@ static int llog_process_thread(void *arg)* the case and re-read the current chunk * otherwise. */ +int records; +if (index > loghandle->lgh_last_idx) { rc =0 ; goto out; } +/* <2 records means no more records +* if the last record we processed was +* the final one, then the underlying drivers/staging/lustre/lustre/obdclass/llog.c static int llog_process_thread(void *arg) · line 340
Quoted 10 lines
drivers/staging/lustre/lustre/obdclass/llog.c +10
-0+* object might have been destroyed yet. +* we better don't access that.. +*/ +mutex_lock (&loghandle->lgh_hdr_mutex); + records = loghandle->lgh_hdr->llh_count; +mutex_unlock (&loghandle->lgh_hdr_mutex); +if (records <=1 ) { + rc =0 ; + goto out; + }So you now use the lock, in only one place, when reading a single value? That makes no sense, it's obviously wrong, or not needed.
Quoted 1 line
Please fix up these two patches?
Ah, this is in fact server-side fix, so all the other users were in the parts not really present in the client.
James, we don't really need this patch in the client, I guess.
PATCH 14/14 staging: lustre: lprocfs: move lprocfs_stats_[un]lock to a source file
In reply to James SimmonsWhen compiling the kernel without optimization, when using GCOV, the lprocfs_stats_alloc_one() symbol is not properly exported to other modules and causes the ptlrpc module to fail loading with an unknown symbol. There is no reason to export the function lprocfs_stats_alloc_one. The reason is due to the functions lprocfs_stats_[un]lock being inline functions in a header file. Lets untangle this mess and turn those inline functions into real functions in a source file.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8836
Reviewed-on: https://review.whamcloud.com/23773
--- .../staging/lustre/lustre/include/lprocfs_status.h | 120 ++------------------- .../lustre/lustre/obdclass/lprocfs_status.c | 111 +++++++++++++++++++ 2 files changed, 121 insertions(+), 110 deletions(-)
drivers/staging/lustre/lustre/include/lprocfs_status.h +10 -110
@@ -374,94 +374,15 @@ int lprocfs_write_frac_helper(const char __user *buffer, unsigned long count, int *val, int mult);int lprocfs_read_frac_helper (char *buffer,unsigned long count,long val,int mult); -int lprocfs_stats_alloc_one (struct lprocfs_stats *stats,unsigned int cpuid); -/** -* Lock statistics structure for access, possibly only on this CPU. -* -* The statistics struct may be allocated with per-CPU structures for -* efficient concurrent update (usually only on server-wide stats), or -* as a single global struct (e.g. for per-client or per-job statistics), -* so the required locking depends on the type of structure allocated. -* -* For per-CPU statistics, pin the thread to the current cpuid so that -* will only access the statistics for that CPU. If the stats structure -* for the current CPU has not been allocated (or previously freed), -* allocate it now. The per-CPU statistics do not need locking since -* the thread is pinned to the CPU during update. -* -* For global statistics, lock the stats structure to prevent concurrent update. -* -* \param[in] stats statistics structure to lock -* \param[in] opc type of operation: -* LPROCFS_GET_SMP_ID: "lock" and return current CPU index -* for incrementing statistics for that CPU -* LPROCFS_GET_NUM_CPU: "lock" and return number of used -* CPU indices to iterate over all indices -* \param[out] flags CPU interrupt saved state for IRQ-safe locking -* -* \retval cpuid of current thread or number of allocated structs -* \retval negative on error (only for opc LPROCFS_GET_SMP_ID + per-CPU stats) -*/ -static inline int lprocfs_stats_lock (struct lprocfs_stats *stats, -enum lprocfs_stats_lock_ops opc, -unsigned long *flags) -{ -if (stats->ls_flags &LPROCFS_STATS_FLAG_NOPERCPU ) { -if (stats->ls_flags &LPROCFS_STATS_FLAG_IRQ_SAFE ) -spin_lock_irqsave (&stats->ls_lock, *flags); -else -spin_lock (&stats->ls_lock); -return opc ==LPROCFS_GET_NUM_CPU ?1 :0 ; - } - -switch (opc) { -case LPROCFS_GET_SMP_ID : { -unsigned int cpuid =get_cpu (); - -if (unlikely (!stats->ls_percpu[cpuid])) { -int rc =lprocfs_stats_alloc_one (stats, cpuid); - -if (rc <0 ) { -put_cpu (); -return rc; - } - } -return cpuid; - } -case LPROCFS_GET_NUM_CPU : -return stats->ls_biggest_alloc_num; -default : -LBUG (); - } -} - -/** -* Unlock statistics structure after access. -* -* Unlock the lock acquired via lprocfs_stats_lock() for global statistics, -* or unpin this thread from the current cpuid for per-CPU statistics. -* -* This function must be called using the same arguments as used when calling -* lprocfs_stats_lock() so that the correct operation can be performed. -* -* \param[in] stats statistics structure to unlock -* \param[in] opc type of operation (current cpuid or number of structs) -* \param[in] flags CPU interrupt saved state for IRQ-safe locking -*/ -static inline void lprocfs_stats_unlock (struct lprocfs_stats *stats, -enum lprocfs_stats_lock_ops opc, -unsigned long *flags) -{ -if (stats->ls_flags &LPROCFS_STATS_FLAG_NOPERCPU ) { -if (stats->ls_flags &LPROCFS_STATS_FLAG_IRQ_SAFE ) -spin_unlock_irqrestore (&stats->ls_lock, *flags); -else -spin_unlock (&stats->ls_lock); - }else if (opc ==LPROCFS_GET_SMP_ID ) { -put_cpu (); - } -} +int lprocfs_stats_alloc_one (struct lprocfs_stats *stats, +unsigned int cpuid); +int lprocfs_stats_lock (struct lprocfs_stats *stats, +enum lprocfs_stats_lock_ops opc, +unsigned long *flags); +void lprocfs_stats_unlock (struct lprocfs_stats *stats, +enum lprocfs_stats_lock_ops opc, +unsigned long *flags);static inline unsigned int lprocfs_stats_counter_size (struct lprocfs_stats *stats)
@@ -513,29 +434,8 @@ __s64 lprocfs_read_helper(struct lprocfs_counter *lc,struct lprocfs_counter_header *header, enum lprocfs_stats_flags flags, enum lprocfs_fields_flags field); -static inline __u64 lprocfs_stats_collector (struct lprocfs_stats *stats, -int idx, -enum lprocfs_fields_flags field) -{ -unsigned int i; -unsigned int num_cpu; -unsigned long flags =0 ; -__u64 ret =0 ; - -LASSERT (stats); - - num_cpu =lprocfs_stats_lock (stats,LPROCFS_GET_NUM_CPU , &flags); -for (i =0 ; i < num_cpu; i++) { -if (!stats->ls_percpu[i]) -continue ; - ret +=lprocfs_read_helper ( -lprocfs_stats_counter_get (stats, i, idx), - &stats->ls_cnt_header[idx], stats->ls_flags, - field); - } -lprocfs_stats_unlock (stats,LPROCFS_GET_NUM_CPU , &flags); -return ret; -} +__u64 lprocfs_stats_collector (struct lprocfs_stats *stats,int idx, +enum lprocfs_fields_flags field);extern struct lprocfs_stats *lprocfs_alloc_stats (unsigned int num,enum lprocfs_stats_flags flags);
drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +111 -0
123 lines not on this page · raw message
Signature · 1 line
1.8.3.1