staging: lustre: batch of fixes to decrease test failures
cover staging: lustre: batch of fixes to decrease test failures
New batch of patches to reduce the number of the bugs we are seeing in our testing of the upstream client. This set of patches is order independent. Removal of some dead code in the lov layer as well.
Andriy Skulysh (1):
staging: lustre: ldlm: crash on umount in cleanup_resource
Bob Glosman (1):
staging: lustre: ptlrpc: print times in microseconds
Bobi Jam (1):
staging: lustre: osc: soft lock - osc_makes_rpc()
Dmitry Eremin (2):
staging: lustre: llite: allow cached acls
staging: lustre: llite: add xattr.h header to xattr.c
Fan Yong (1):
staging: lustre: linkea: linkEA size limitation
James Simmons (6):
staging: lustre: ldlm: restore interval_iterate_reverse function
staging: lustre: lustre: fix all less than 0 comparison for unsigned values
staging: lustre: ptlrpc: restore 64-bit time for struct ptlrpc_cli_req
staging: lustre: ptlrpc: don't use CFS_DURATION_T for time64_t
staging: lustre: libcfs: fix test for libcfs_ioctl_hdr minimum size
staging: lustre: llite: set security xattr using __vfs_setxattr
John L. Hammond (4):
staging: lustre: ldlm: restore missing newlines in ldlm sysfs files
staging: lustre: lov: remove unused code
staging: lustre: lmv: assume a real connection in lmv_connect()
staging: lustre: ptlrpc: correct use of list_add_tail()
Nathaniel Clark (1):
staging: lustre: lov: Ensure correct operation for large object sizes
Niu Yawei (1):
staging: lustre: ptlrpc: no need to reassign mbits for replay
Robin Humble (1):
staging: lustre: llite: Remove filtering of seclabel xattr
Sebastien Buisson (1):
staging: lustre: lov: fix 'control flow' error in lov_io_init_released
drivers/staging/lustre/lnet/libcfs/hash.c | 47 ++++-- .../lustre/lnet/libcfs/linux/linux-module.c | 2 +- drivers/staging/lustre/lustre/include/cl_object.h | 2 +- .../staging/lustre/lustre/include/interval_tree.h | 4 + .../lustre/lustre/include/lustre/lustre_idl.h | 7 +- .../staging/lustre/lustre/include/lustre_linkea.h | 15 +- drivers/staging/lustre/lustre/include/lustre_net.h | 10 +- drivers/staging/lustre/lustre/include/obd.h | 2 - drivers/staging/lustre/lustre/include/obd_class.h | 9 +- drivers/staging/lustre/lustre/ldlm/interval_tree.c | 40 +++++ drivers/staging/lustre/lustre/ldlm/ldlm_internal.h | 3 - drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 47 +----- drivers/staging/lustre/lustre/llite/file.c | 61 +++++++- .../staging/lustre/lustre/llite/llite_internal.h | 4 + drivers/staging/lustre/lustre/llite/llite_lib.c | 6 +- drivers/staging/lustre/lustre/llite/namei.c | 6 + drivers/staging/lustre/lustre/llite/rw.c | 2 +- drivers/staging/lustre/lustre/llite/xattr.c | 1 + .../staging/lustre/lustre/llite/xattr_security.c | 23 ++- drivers/staging/lustre/lustre/lmv/lmv_intent.c | 5 - drivers/staging/lustre/lustre/lmv/lmv_internal.h | 2 - drivers/staging/lustre/lustre/lmv/lmv_obd.c | 161 +++------------------ drivers/staging/lustre/lustre/lov/Makefile | 2 +- .../staging/lustre/lustre/lov/lov_cl_internal.h | 90 ------------ drivers/staging/lustre/lustre/lov/lov_dev.c | 85 ----------- drivers/staging/lustre/lustre/lov/lov_ea.c | 23 +-- drivers/staging/lustre/lustre/lov/lov_internal.h | 27 ---- drivers/staging/lustre/lustre/lov/lov_io.c | 146 ++++++------------- drivers/staging/lustre/lustre/lov/lov_lock.c | 11 -- drivers/staging/lustre/lustre/lov/lov_obd.c | 3 +- drivers/staging/lustre/lustre/lov/lov_object.c | 8 +- drivers/staging/lustre/lustre/lov/lov_page.c | 1 - drivers/staging/lustre/lustre/lov/lov_request.c | 40 +---- drivers/staging/lustre/lustre/lov/lovsub_dev.c | 1 - drivers/staging/lustre/lustre/lov/lovsub_io.c | 51 ------- drivers/staging/lustre/lustre/lov/lovsub_lock.c | 2 - drivers/staging/lustre/lustre/mdc/lproc_mdc.c | 2 +- drivers/staging/lustre/lustre/obdclass/linkea.c | 69 +++++++-- drivers/staging/lustre/lustre/osc/osc_cache.c | 31 +++- drivers/staging/lustre/lustre/ptlrpc/client.c | 35 +++-- .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 15 +- drivers/staging/lustre/lustre/ptlrpc/sec_gc.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/service.c | 15 +- drivers/staging/lustre/lustre/ptlrpc/wiretest.c | 16 +- 44 files changed, 416 insertions(+), 718 deletions(-) delete mode 100644 drivers/staging/lustre/lustre/lov/lovsub_io.c
Signature · 1 line
1.8.3.1
PATCH 1/20 staging: lustre: osc: soft lock - osc_makes_rpc()
From: Bobi Jam <[email protected]>
It is possible that an osc_extent contains more than 256 chunks, and the IO engine won't add this extent in one RPC (try_to_add_extent_for_io) so that osc_check_rpcs() run into a loop upon this extent and never break.
This patch changes osc_max_write_chunks() to make sure the value can cover all possible osc_extent, so that all osc_extent will be added into one RPC.
This patch also add another field erd_max_extents in extent_rpc_data to make sure not to add too many fragments in a single RPC.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8680
Reviewed-on: http://review.whamcloud.com/23326
--- drivers/staging/lustre/lustre/osc/osc_cache.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-)
drivers/staging/lustre/lustre/osc/osc_cache.c +21 -3
@@ -1887,6 +1887,7 @@ struct extent_rpc_data {unsigned int erd_page_count;unsigned int erd_max_pages;unsigned int erd_max_chunks; +unsigned int erd_max_extents; };static inline unsigned int osc_extent_chunks (const struct osc_extent *ext)
@@ -1915,11 +1916,23 @@ static int try_to_add_extent_for_io(struct client_obd *cli,EASSERT ((ext->oe_state ==OES_CACHE || ext->oe_state ==OES_LOCK_DONE ), ext); +if (!data->erd_max_extents) +return 0 ; + chunk_count =osc_extent_chunks (ext); +EASSERTF (data->erd_page_count !=0 || + chunk_count <= data->erd_max_chunks, ext, +"The first extent to be fit in a RPC contains %u chunks, which is over the limit %u.\n" , + chunk_count, data->erd_max_chunks); +if (chunk_count > data->erd_max_chunks)return 0 ; data->erd_max_pages =max (ext->oe_mppr, data->erd_max_pages); +EASSERTF (data->erd_page_count !=0 || + ext->oe_nr_pages <= data->erd_max_pages, ext, +"The first extent to be fit in a RPC contains %u pages, which is over the limit %u.\n" , + ext->oe_nr_pages, data->erd_max_pages);if (data->erd_page_count + ext->oe_nr_pages > data->erd_max_pages)return 0 ;
@@ -1943,6 +1956,7 @@ static int try_to_add_extent_for_io(struct client_obd *cli,break ; } + data->erd_max_extents--; data->erd_max_chunks -= chunk_count; data->erd_page_count += ext->oe_nr_pages;list_move_tail (&ext->oe_link, data->erd_rpc_list);
@@ -1972,10 +1986,12 @@ static inline unsigned int osc_max_write_chunks(const struct client_obd *cli)* * This limitation doesn't apply to ldiskfs, which allows as many * chunks in one RPC as we want. However, it won't have any benefits -* to have too many discontiguous pages in one RPC. Therefore, it -* can only have 256 chunks at most in one RPC. +* to have too many discontiguous pages in one RPC. +* +* An osc_extent won't cover over a RPC size, so the chunks in an +* osc_extent won't bigger than PTLRPC_MAX_BRW_SIZE >> chunkbits. */ -return min (PTLRPC_MAX_BRW_SIZE >> cli->cl_chunkbits,256 ); +return PTLRPC_MAX_BRW_SIZE >> cli->cl_chunkbits; }/**
@@ -2002,6 +2018,7 @@ static unsigned int get_write_extents(struct osc_object *obj, .erd_page_count = 0, .erd_max_pages = cli->cl_max_pages_per_rpc, .erd_max_chunks = osc_max_write_chunks(cli), + .erd_max_extents = 256, };LASSERT (osc_object_is_locked (obj));
@@ -2140,6 +2157,7 @@ static unsigned int get_write_extents(struct osc_object *obj, .erd_page_count = 0, .erd_max_pages = cli->cl_max_pages_per_rpc, .erd_max_chunks = UINT_MAX, + .erd_max_extents = UINT_MAX, };int rc =0 ;
Signature · 1 line
1.8.3.1
PATCH 2/20 staging: lustre: ldlm: restore missing newlines in ldlm sysfs files
In reply to James SimmonsFrom: "John L. Hammond" <[email protected]>
Restore the missing trailing newlines in /sys/fs/lustre/ldlm/namespaces/*/lru_{max_age,size}.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-9109
Reviewed-on: https://review.whamcloud.com/25522
--- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/ldlm/ldlm_resource.c +2 -2
@@ -223,7 +223,7 @@ static ssize_t lru_size_show(struct kobject *kobj, struct attribute *attr,if (ns_connect_lru_resize (ns)) nr = &ns->ns_nr_unused; -return sprintf (buf,"%u" , *nr); +return sprintf (buf,"%u\n" , *nr); } static ssize_t lru_size_store(struct kobject *kobj, struct attribute *attr,
@@ -318,7 +318,7 @@ static ssize_t lru_max_age_show(struct kobject *kobj, struct attribute *attr, struct ldlm_namespace *ns = container_of(kobj, struct ldlm_namespace, ns_kobj); -return sprintf (buf,"%u" , ns->ns_max_age); +return sprintf (buf,"%u\n" , ns->ns_max_age); } static ssize_t lru_max_age_store(struct kobject *kobj, struct attribute *attr,
Signature · 1 line
1.8.3.1
PATCH 3/20 staging: lustre: ldlm: crash on umount in cleanup_resource
In reply to James SimmonsFrom: Andriy Skulysh <[email protected]>
cfs_hash_for_each_relax() assumes that cfs_hash_put_locked() doesn't release bd lock, but it isn't true for ldlm_res_hop_put_locked().
Add recfcount on next hnode in cfs_hash_for_each_relax() and remove ldlm_res_hop_put_locked()
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6304
Xyratex-bug-id: MRP-2352
Reviewed-on: http://review.whamcloud.com/13908
--- drivers/staging/lustre/lnet/libcfs/hash.c | 47 ++++++++++++++-------- drivers/staging/lustre/lustre/ldlm/ldlm_internal.h | 3 -- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 43 -------------------- 3 files changed, 31 insertions(+), 62 deletions(-)
drivers/staging/lustre/lnet/libcfs/hash.c +31 -16
@@ -1008,7 +1008,7 @@ struct cfs_hash *LASSERT (ops->hs_object);LASSERT (ops->hs_keycmp);LASSERT (ops->hs_get); -LASSERT (ops->hs_put_locked); +LASSERT (ops->hs_put || ops->hs_put_locked);if (flags &CFS_HASH_REHASH ) flags |=CFS_HASH_COUNTER ;/* must have counter */
@@ -1553,19 +1553,20 @@ struct cfs_hash_cond_arg { cfs_hash_for_each_relax(struct cfs_hash *hs, cfs_hash_for_each_cb_t func, void *data, int start) { + struct hlist_node *next = NULL;struct hlist_node *hnode; -struct hlist_node *tmp;struct cfs_hash_bd bd;u32 version;int count =0 ;int stop_on_change; +int has_put_locked;int end =-1 ;int rc =0 ;int i; stop_on_change =cfs_hash_with_rehash_key (hs) || - !cfs_hash_with_no_itemref (hs) || - !hs->hs_ops->hs_put_locked; + !cfs_hash_with_no_itemref (hs); + has_put_locked = hs->hs_ops->hs_put_locked !=NULL ;cfs_hash_lock (hs,0 ); again:LASSERT (!cfs_hash_is_rehashing (hs));
@@ -1582,38 +1583,52 @@ struct cfs_hash_cond_arg { version =cfs_hash_bd_version_get (&bd);cfs_hash_bd_for_each_hlist (hs, &bd, hhead) { -for (hnode = hhead->first; hnode;) { + hnode = hhead->first; +if (!hnode) +continue ; +cfs_hash_get (hs, hnode); + +for (; hnode; hnode = next) {cfs_hash_bucket_validate (hs, &bd, hnode); -cfs_hash_get (hs, hnode); + next = hnode->next; +if (next) +cfs_hash_get (hs, next);cfs_hash_bd_unlock (hs, &bd,0 );cfs_hash_unlock (hs,0 ); rc =func (hs, &bd, hnode, data); -if (stop_on_change) +if (stop_on_change || !has_put_locked)cfs_hash_put (hs, hnode);cond_resched (); count++;cfs_hash_lock (hs,0 );cfs_hash_bd_lock (hs, &bd,0 ); -if (!stop_on_change) { - tmp = hnode->next; -cfs_hash_put_locked (hs, hnode); - hnode = tmp; - }else {/* bucket changed? */ +if (stop_on_change) {if (version !=cfs_hash_bd_version_get (&bd)) -break ; -/* safe to continue because no change */ - hnode = hnode->next; + rc = -EINTR ; + }else if (has_put_locked) { +cfs_hash_put_locked (hs, hnode); }if (rc)/* callback wants to break iteration */ break ; } -if (rc)/* callback wants to break iteration */ +if (next) { +if (has_put_locked) { +cfs_hash_put_locked (hs, next); + next =NULL ; + }break ; + }else if (rc) { +break ; + } }cfs_hash_bd_unlock (hs, &bd,0 ); +if (next && !has_put_locked) { +cfs_hash_put (hs, next); + next =NULL ; + }if (rc)/* callback wants to break iteration */ break ; }
drivers/staging/lustre/lustre/ldlm/ldlm_internal.h +0 -3
@@ -106,9 +106,6 @@ int ldlm_cancel_lru_local(struct ldlm_namespace *ns,extern unsigned int ldlm_enqueue_min;extern unsigned int ldlm_cancel_unused_locks_before_replay; -/* ldlm_resource.c */ -int ldlm_resource_putref_locked (struct ldlm_resource *res); -/* ldlm_lock.c */ struct ldlm_cb_set_arg {
drivers/staging/lustre/lustre/ldlm/ldlm_resource.c +0 -43
67 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 4/20 staging: lustre: lov: fix 'control flow' error in lov_io_init_released
In reply to James SimmonsFrom: Sebastien Buisson <[email protected]>
Fix "control flow" issues found by Coverity version 6.6.1:
Logically dead code (DEADCODE)
Execution cannot reach this statement.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4048
Reviewed-on: http://review.whamcloud.com/7824
--- drivers/staging/lustre/lustre/lov/lov_io.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/staging/lustre/lustre/lov/lov_io.c +2 -0
@@ -1047,6 +1047,8 @@ int lov_io_init_released(const struct lu_env *env, struct cl_object *obj,switch (io->ci_type) {default :LASSERTF (0 ,"invalid type %d\n" , io->ci_type); + result = -EOPNOTSUPP ; +break ;case CIT_MISC :case CIT_FSYNC :case CIT_DATA_VERSION :
Signature · 1 line
1.8.3.1
PATCH 5/20 staging: lustre: lov: remove unused code
In reply to James SimmonsFrom: "John L. Hammond" <[email protected]>
Remove:
the tested but never set flag OBD_STATFS_PTLRPCD, the empty file lustre/lov/lovsub_io.c,
the unused ld_emerg member of struct lov_device, the unused struct lov_device_emerg and supporting functions, the unused struct lov_lock_link and supporting functions, and the unused, get only, or set only members of struct lovsub_device, lovsub_lock, lov_sublock_env, lov_thread_info, lov_io_sub, lov_io, lov_request, and lov_request_set.
Reduce the scope of several functions from lov_request.c.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5814
Reviewed-on: http://review.whamcloud.com/14878
--- drivers/staging/lustre/lustre/include/obd_class.h | 9 +- drivers/staging/lustre/lustre/lov/Makefile | 2 +- .../staging/lustre/lustre/lov/lov_cl_internal.h | 90 ------------- drivers/staging/lustre/lustre/lov/lov_dev.c | 85 ------------ drivers/staging/lustre/lustre/lov/lov_internal.h | 27 ---- drivers/staging/lustre/lustre/lov/lov_io.c | 144 ++++++--------------- drivers/staging/lustre/lustre/lov/lov_lock.c | 11 -- drivers/staging/lustre/lustre/lov/lov_obd.c | 3 +- drivers/staging/lustre/lustre/lov/lov_page.c | 1 - drivers/staging/lustre/lustre/lov/lov_request.c | 40 +----- drivers/staging/lustre/lustre/lov/lovsub_dev.c | 1 - drivers/staging/lustre/lustre/lov/lovsub_io.c | 51 -------- drivers/staging/lustre/lustre/lov/lovsub_lock.c | 2 - 13 files changed, 53 insertions(+), 413 deletions(-) delete mode 100644 drivers/staging/lustre/lustre/lov/lovsub_io.c
drivers/staging/lustre/lustre/include/obd_class.h +1 -8
@@ -46,14 +46,7 @@#define OBD_STATFS_FROM_CACHE 0x0002/* the statfs callback should not update * obd_osfs_age */ -#define OBD_STATFS_PTLRPCD 0x0004/* requests will be sent via ptlrpcd -* instead of a specific set. This -* means that we cannot rely on the set -* interpret routine to be called. -* lov_statfs_fini() must thus be called -* by the request interpret routine -*/ -#define OBD_STATFS_FOR_MDT0 0x0008/* The statfs is only for retrieving +#define OBD_STATFS_FOR_MDT0 0x0004/* The statfs is only for retrieving * information from MDT0. */
drivers/staging/lustre/lustre/lov/Makefile +1 -1
@@ -2,4 +2,4 @@ obj-$(CONFIG_LUSTRE_FS) += lov.o lov-y := lov_obd.o lov_pack.o lov_offset.o lov_merge.o \ lov_request.o lov_ea.o lov_dev.o lov_object.o lov_page.o \ lov_lock.o lov_io.o lovsub_dev.o lovsub_object.o lovsub_page.o \ - lovsub_lock.o lovsub_io.o lov_pool.o lproc_lov.o + lovsub_lock.o lov_pool.o lproc_lov.o
drivers/staging/lustre/lustre/lov/lov_cl_internal.h +0 -90
167 lines not on this page · raw message
drivers/staging/lustre/lustre/lov/lov_dev.c +0 -85
151 lines not on this page · raw message
drivers/staging/lustre/lustre/lov/lov_internal.h +0 -27
@@ -161,42 +161,21 @@ struct lov_request {struct list_head rq_link;int rq_idx;/* index in lov->tgts array */ -int rq_stripe;/* stripe number */ -int rq_complete; -int rq_rc; - -u32 rq_oabufs; -u32 rq_pgaidx; };struct lov_request_set {struct obd_info *set_oi; -atomic_t set_refcount; -struct obd_export *set_exp; -/* XXX: There is @set_exp already, however obd_statfs gets obd_device -* only. -*/ struct obd_device *set_obd;int set_count;atomic_t set_completes;atomic_t set_success; -atomic_t set_finish_checked;struct list_head set_list; -wait_queue_head_t set_waitq; };extern struct kmem_cache *lov_oinfo_slab;extern struct lu_kmem_descr lov_caches[]; -void lov_finish_set (struct lov_request_set *set); - -static inline void lov_put_reqset (struct lov_request_set *set) -{ -if (atomic_dec_and_test (&set->set_refcount)) -lov_finish_set (set); -} -#define lov_uuid2str (lv, index) \ (char *)((lv)->lov_tgts[index]->ltd_uuid.uuid)
@@ -217,15 +196,9 @@ pgoff_t lov_stripe_pgoff(struct lov_stripe_md *lsm, pgoff_t stripe_index, int stripe);/* lov_request.c */ -int lov_prep_getattr_set (struct obd_export *exp,struct obd_info *oinfo, -struct lov_request_set **reqset); -int lov_fini_getattr_set (struct lov_request_set *set);int lov_prep_statfs_set (struct obd_device *obd,struct obd_info *oinfo,struct lov_request_set **reqset); -int lov_fini_statfs (struct obd_device *obd,struct obd_statfs *osfs, -int success);int lov_fini_statfs_set (struct lov_request_set *set); -int lov_statfs_interpret (struct ptlrpc_request_set *rqset,void *data,int rc);/* lov_obd.c */ void lov_stripe_lock (struct lov_stripe_md *md);
drivers/staging/lustre/lustre/lov/lov_io.c +43 -101
253 lines not on this page · raw message
drivers/staging/lustre/lustre/lov/lov_lock.c +0 -11
@@ -71,13 +71,11 @@ static struct lov_sublock_env *lov_sublock_env_get(const struct lu_env *env,if (!io || !cl_object_same (io->ci_obj, parent->cll_descr.cld_obj)) { subenv->lse_env = env; subenv->lse_io = io; - subenv->lse_sub =NULL ; }else { sub =lov_sub_get (env, lio, lls->sub_stripe);if (!IS_ERR (sub)) { subenv->lse_env = sub->sub_env; subenv->lse_io = sub->sub_io; - subenv->lse_sub = sub; }else { subenv = (void *)sub; }
@@ -85,12 +83,6 @@ static struct lov_sublock_env *lov_sublock_env_get(const struct lu_env *env,return subenv; } -static void lov_sublock_env_put (struct lov_sublock_env *subenv) -{ -if (subenv && subenv->lse_sub) -lov_sub_put (subenv->lse_sub); -} -static int lov_sublock_init (const struct lu_env *env,const struct cl_lock *parent,struct lov_lock_sub *lls)
@@ -102,7 +94,6 @@ static int lov_sublock_init(const struct lu_env *env,if (!IS_ERR (subenv)) { result =cl_lock_init (subenv->lse_env, &lls->sub_lock, subenv->lse_io); -lov_sublock_env_put (subenv); }else {/* error occurs. */ result =PTR_ERR (subenv);
@@ -244,7 +235,6 @@ static int lov_lock_enqueue(const struct lu_env *env, } rc =cl_lock_enqueue (subenv->lse_env, subenv->lse_io, &lls->sub_lock, anchor); -lov_sublock_env_put (subenv);if (rc !=0 )break ;
@@ -272,7 +262,6 @@ static void lov_lock_cancel(const struct lu_env *env, subenv =lov_sublock_env_get (env, lock, lls);if (!IS_ERR (subenv)) {cl_lock_cancel (subenv->lse_env, sublock); -lov_sublock_env_put (subenv); }else { CL_LOCK_DEBUG(D_ERROR, env, slice->cls_lock, "lov_lock_cancel fails with %ld.\n",
drivers/staging/lustre/lustre/lov/lov_obd.c +2 -1
@@ -947,7 +947,8 @@ int lov_process_config_base(struct obd_device *obd, struct lustre_cfg *lcfg,return rc; } -int lov_statfs_interpret (struct ptlrpc_request_set *rqset,void *data,int rc) +static int +lov_statfs_interpret (struct ptlrpc_request_set *rqset,void *data,int rc) {struct lov_request_set *lovset = (struct lov_request_set *)data;int err;
drivers/staging/lustre/lustre/lov/lov_page.c +0 -1
@@ -100,7 +100,6 @@ int lov_page_init_raid0(const struct lu_env *env, struct cl_object *obj,break ; } } -lov_sub_put (sub);return rc; }
drivers/staging/lustre/lustre/lov/lov_request.c +6 -34
@@ -43,13 +43,10 @@ static void lov_init_set(struct lov_request_set *set) set->set_count =0 ;atomic_set (&set->set_completes,0 );atomic_set (&set->set_success,0 ); -atomic_set (&set->set_finish_checked,0 );INIT_LIST_HEAD (&set->set_list); -atomic_set (&set->set_refcount,1 ); -init_waitqueue_head (&set->set_waitq); } -void lov_finish_set (struct lov_request_set *set) +static void lov_finish_set (struct lov_request_set *set) {struct list_head *pos, *n;
@@ -66,32 +63,12 @@ void lov_finish_set(struct lov_request_set *set)kfree (set); } -static int lov_set_finished (struct lov_request_set *set,int idempotent) -{ -int completes =atomic_read (&set->set_completes); - -CDEBUG (D_INFO ,"check set %d/%d\n" , completes, set->set_count); - -if (completes == set->set_count) { -if (idempotent) -return 1 ; -if (atomic_inc_return (&set->set_finish_checked) ==1 ) -return 1 ; - } -return 0 ; -} -static void lov_update_set (struct lov_request_set *set,struct lov_request *req,int rc) { - req->rq_complete =1 ; - req->rq_rc = rc; -atomic_inc (&set->set_completes);if (rc ==0 )atomic_inc (&set->set_success); - -wake_up (&set->set_waitq); } static void lov_set_add_req(struct lov_request *req,
@@ -173,8 +150,8 @@ static int lov_check_and_wait_active(struct lov_obd *lov, int ost_idx) (tot) += (add); \ }while (0 ) -int lov_fini_statfs(struct obd_device *obd, struct obd_statfs *osfs, - int success) +static int lov_fini_statfs(struct obd_device *obd, struct obd_statfs *osfs, +int success) {if (success) { __u32 expected_stripes = lov_get_stripecnt(&obd->u.lov,
@@ -205,7 +182,9 @@ int lov_fini_statfs_set(struct lov_request_set *set) rc =lov_fini_statfs (set->set_obd, set->set_oi->oi_osfs,atomic_read (&set->set_success)); } -lov_put_reqset (set); + +lov_finish_set (set); +return rc; }
@@ -307,14 +286,7 @@ static int cb_statfs_update(void *cookie, int rc) out_update:lov_update_statfs (osfs, lov_sfs, success);obd_putref (lovobd); - out: -if (set->set_oi->oi_flags &OBD_STATFS_PTLRPCD && -lov_set_finished (set,0 )) { -lov_statfs_interpret (NULL , set, set->set_count != -atomic_read (&set->set_success)); - } -return 0 ; }
drivers/staging/lustre/lustre/lov/lovsub_dev.c +0 -1
@@ -77,7 +77,6 @@ static struct lu_device *lovsub_device_fini(const struct lu_env *env, lsd =lu2lovsub_dev (d); next =cl2lu_dev (lsd->acid_next); - lsd->acid_super =NULL ; lsd->acid_next =NULL ;return next; }
drivers/staging/lustre/lustre/lov/lovsub_io.c deleted +0 -51
51 lines not on this page · raw message
drivers/staging/lustre/lustre/lov/lovsub_lock.c +0 -2
@@ -54,7 +54,6 @@ static void lovsub_lock_fini(const struct lu_env *env,struct lovsub_lock *lsl; lsl =cl2lovsub_lock (slice); -LASSERT (list_empty (&lsl->lss_parents));kmem_cache_free (lovsub_lock_kmem, lsl); }
@@ -70,7 +69,6 @@ int lovsub_lock_init(const struct lu_env *env, struct cl_object *obj, lsk =kmem_cache_zalloc (lovsub_lock_kmem,GFP_NOFS );if (lsk) { -INIT_LIST_HEAD (&lsk->lss_parents);cl_lock_slice_add (lock, &lsk->lss_cl, obj, &lovsub_lock_ops); result =0 ; }else {
Signature · 1 line
1.8.3.1
PATCH 6/20 staging: lustre: lmv: assume a real connection in lmv_connect()
In reply to James SimmonsFrom: "John L. Hammond" <[email protected]>
Assume a real connection in lmv_connect(). Mark OBD_CONNECT_REAL obsolete. Remove the then unnecessary refcount and exp members of struct lmv_obd. Remove calls to lmv_check_connect(). Disconnect the export in the appropriate error path of lmv_connect().
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7669
Reviewed-on: http://review.whamcloud.com/18018
--- .../lustre/lustre/include/lustre/lustre_idl.h | 2 +- drivers/staging/lustre/lustre/include/obd.h | 2 - drivers/staging/lustre/lustre/llite/llite_lib.c | 3 - drivers/staging/lustre/lustre/lmv/lmv_intent.c | 5 - drivers/staging/lustre/lustre/lmv/lmv_internal.h | 2 - drivers/staging/lustre/lustre/lmv/lmv_obd.c | 161 +++------------------ 6 files changed, 23 insertions(+), 152 deletions(-)
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +1 -1
@@ -1122,7 +1122,7 @@ struct ptlrpc_body_v2 {#define OBD_CONNECT_AT 0x1000000ULL/*client uses AT */ #define OBD_CONNECT_LRU_RESIZE 0x2000000ULL/*LRU resize feature. */ #define OBD_CONNECT_MDS_MDS 0x4000000ULL/*MDS-MDS connection */ -#define OBD_CONNECT_REAL 0x8000000ULL/*real connection */ +#define OBD_CONNECT_REAL 0x8000000ULL/* obsolete since 2.8 */ #define OBD_CONNECT_CHANGE_QS 0x10000000ULL/*Not used since 2.4 */ #define OBD_CONNECT_CKSUM 0x20000000ULL/*support several cksum algos*/ #define OBD_CONNECT_FID 0x40000000ULL/*FID is supported by server */
drivers/staging/lustre/lustre/include/obd.h +0 -2
@@ -404,12 +404,10 @@ struct lmv_tgt_desc { };struct lmv_obd { -int refcount;struct lu_client_fld lmv_fld;spinlock_t lmv_lock;struct lmv_desc desc;struct obd_uuid cluuid; -struct obd_export *exp;struct mutex lmv_init_mutex;int connected;
drivers/staging/lustre/lustre/llite/llite_lib.c +0 -3
@@ -222,9 +222,6 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,else sbi->ll_fop = &ll_file_operations_noflock; -/* real client */ - data->ocd_connect_flags |=OBD_CONNECT_REAL ; -/* always ping even if server suppress_pings */ if (sbi->ll_flags &LL_SBI_ALWAYS_PING ) data->ocd_connect_flags &= ~OBD_CONNECT_PINGLESS ;
drivers/staging/lustre/lustre/lmv/lmv_intent.c +0 -5
@@ -474,7 +474,6 @@ int lmv_intent_lock(struct obd_export *exp, struct md_op_data *op_data,ldlm_blocking_callback cb_blocking, __u64 extra_lock_flags) { -struct obd_device *obd = exp->exp_obd; int rc;LASSERT (fid_is_sane (&op_data->op_fid1));
@@ -484,10 +483,6 @@ int lmv_intent_lock(struct obd_export *exp, struct md_op_data *op_data, (int )op_data->op_namelen, op_data->op_name, PFID(&op_data->op_fid1)); - rc =lmv_check_connect (obd); -if (rc) -return rc; -if (it->it_op & (IT_LOOKUP |IT_GETATTR |IT_LAYOUT )) rc =lmv_intent_lookup (exp, op_data, it, reqp, cb_blocking, extra_lock_flags);
drivers/staging/lustre/lustre/lmv/lmv_internal.h +0 -2
@@ -42,8 +42,6 @@#define LL_IT2STR (it) \ ((it) ? ldlm_it2str((it)->it_op) : "0") -int lmv_check_connect (struct obd_device *obd); - int lmv_intent_lock(struct obd_export *exp, struct md_op_data *op_data, struct lookup_intent *it, struct ptlrpc_request **reqp, ldlm_blocking_callback cb_blocking,
drivers/staging/lustre/lustre/lmv/lmv_obd.c +22 -139
368 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 7/20 staging: lustre: lov: Ensure correct operation for large object sizes
In reply to James SimmonsFrom: Nathaniel Clark <[email protected]>
If a backing filesystem (ZFS) returns that it supports very large (LLONG_MAX) object sizes, that should be correctly supported. This fixes the check for unitialized stripe_maxbytes in lsm_unpackmd_common(), so that ZFS can return LLONG_MAX and it will be okay. This issue is excersized by writing to or past the 2TB boundry of a singly stripped file.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7890
Reviewed-on: http://review.whamcloud.com/19066
--- drivers/staging/lustre/lustre/lov/lov_ea.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)
drivers/staging/lustre/lustre/lov/lov_ea.c +13 -10
@@ -150,9 +150,10 @@ static int lsm_unpackmd_common(struct lov_obd *lov,struct lov_mds_md *lmm, struct lov_ost_data_v1 *objects) { - loff_t stripe_maxbytes = LLONG_MAX; + loff_t min_stripe_maxbytes = 0;unsigned int stripe_count;struct lov_oinfo *loi; +loff_t lov_bytes;unsigned int i;/*
@@ -168,8 +169,6 @@ static int lsm_unpackmd_common(struct lov_obd *lov, stripe_count =lsm_is_released (lsm) ?0 : lsm->lsm_stripe_count;for (i =0 ; i < stripe_count; i++) { -loff_t tgt_bytes; - loi = lsm->lsm_oinfo[i];ostid_le_to_cpu (&objects[i].l_ost_oi, &loi->loi_oi); loi->loi_ost_idx =le32_to_cpu (objects[i].l_ost_idx);
@@ -194,17 +193,21 @@ static int lsm_unpackmd_common(struct lov_obd *lov,continue ; } - tgt_bytes =lov_tgt_maxbytes (lov->lov_tgts[loi->loi_ost_idx]); - stripe_maxbytes =min_t (loff_t, stripe_maxbytes, tgt_bytes); + lov_bytes =lov_tgt_maxbytes (lov->lov_tgts[loi->loi_ost_idx]); +if (min_stripe_maxbytes ==0 || lov_bytes < min_stripe_maxbytes) + min_stripe_maxbytes = lov_bytes; } -if (stripe_maxbytes ==LLONG_MAX ) - stripe_maxbytes =LUSTRE_EXT3_STRIPE_MAXBYTES ; +if (min_stripe_maxbytes ==0 ) + min_stripe_maxbytes =LUSTRE_EXT3_STRIPE_MAXBYTES ; + + stripe_count = lsm->lsm_stripe_count ?: lov->desc.ld_tgt_count; + lov_bytes = min_stripe_maxbytes * stripe_count; -if (!lsm->lsm_stripe_count) - lsm->lsm_maxbytes = stripe_maxbytes * lov->desc.ld_tgt_count; +if (lov_bytes < min_stripe_maxbytes)/* handle overflow */ + lsm->lsm_maxbytes =MAX_LFS_FILESIZE ;else - lsm->lsm_maxbytes = stripe_maxbytes * lsm->lsm_stripe_count; + lsm->lsm_maxbytes = lov_bytes;return 0 ; }
Signature · 1 line
1.8.3.1
PATCH 8/20 staging: lustre: ptlrpc: correct use of list_add_tail()
In reply to James SimmonsFrom: "John L. Hammond" <[email protected]>
With people starting to test security enabled ptlrpc a list_del corruption was reported. The reason for this error was tracked down to wrong arguments to list_add_tail(). In sptlrpc_gc_add_sec() swap the arguments to list_add_tail() so that it does what we meant it to do.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8270
Reviewed-on: http://review.whamcloud.com/20784
--- drivers/staging/lustre/lustre/ptlrpc/sec_gc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/ptlrpc/sec_gc.c +1 -1
@@ -66,7 +66,7 @@ void sptlrpc_gc_add_sec(struct ptlrpc_sec *sec) sec->ps_gc_next =ktime_get_real_seconds () + sec->ps_gc_interval;spin_lock (&sec_gc_list_lock); -list_add_tail (&sec_gc_list, &sec->ps_gc_list); +list_add_tail (&sec->ps_gc_list, &sec_gc_list);spin_unlock (&sec_gc_list_lock);CDEBUG (D_SEC ,"added sec %p(%s)\n" , sec, sec->ps_policy->sp_name);
Signature · 1 line
1.8.3.1
PATCH 9/20 staging: lustre: ptlrpc: no need to reassign mbits for replay
In reply to James SimmonsFrom: Niu Yawei <[email protected]>
It's not necessary reassgin & re-adjust rq_mbits for replay request in ptlrpc_set_bulk_mbits(), they all must have already been correctly assigned before.
Such unecessary reassign could make the first matchbit not PTLRPC_BULK_OPS_MASK aligned, that'll trigger LASSERT in ptlrpc_register_bulk():
- ptlrpc_set_bulk_mbits() is called when first time sending request, rq_mbits is set as xid, which is BULK_OPS aligned;
- ptlrpc_set_bulk_mbits() continue to adjust the mbits for multi-bulk RPC, rq_mbits is not aligned anymore, then rq_xid is changed accordingly if client is connecting to an old server, so rq_xid became unaligned too;
- The request is replayed, ptlrpc_set_bulk_mbits() reassign the rq_mbits as rq_xid, which isn't aligned already, but ptlrpc_register_bulk() still assumes this value as the first matchbits and LASSERT it's BULK_OPS aligned.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6808
Reviewed-on: http://review.whamcloud.com/23048
--- drivers/staging/lustre/lustre/ptlrpc/client.c | 28 +++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-)
drivers/staging/lustre/lustre/ptlrpc/client.c +22 -6
@@ -3116,13 +3116,20 @@ void ptlrpc_set_bulk_mbits(struct ptlrpc_request *req)LASSERT (bd); -if (!req->rq_resend) { -/* this request has a new xid, just use it as bulk matchbits */ - req->rq_mbits = req->rq_xid; - - }else {/* needs to generate a new matchbits for resend */ +/* +* Generate new matchbits for all resend requests, including +* resend replay. +*/ +if (req->rq_resend) {u64 old_mbits = req->rq_mbits; +/* +* First time resend on -EINPROGRESS will generate new xid, +* so we can actually use the rq_xid as rq_mbits in such case, +* however, it's bit hard to distinguish such resend with a +* 'resend for the -EINPROGRESS resend'. To make it simple, +* we opt to generate mbits for all resend cases. +*/ if ((bd->bd_import->imp_connect_data.ocd_connect_flags &OBD_CONNECT_BULK_MBITS )) { req->rq_mbits =ptlrpc_next_xid ();
@@ -3131,12 +3138,21 @@ void ptlrpc_set_bulk_mbits(struct ptlrpc_request *req)spin_lock (&req->rq_import->imp_lock);list_del_init (&req->rq_unreplied_list);ptlrpc_assign_next_xid_nolock (req); - req->rq_mbits = req->rq_xid;spin_unlock (&req->rq_import->imp_lock); + req->rq_mbits = req->rq_xid; }CDEBUG (D_HA ,"resend bulk old x%llu new x%llu\n" , old_mbits, req->rq_mbits); + }else if (!(lustre_msg_get_flags (req->rq_reqmsg) &MSG_REPLAY )) { +/* Request being sent first time, use xid as matchbits. */ + req->rq_mbits = req->rq_xid; + }else { +/* +* Replay request, xid and matchbits have already been +* correctly assigned. +*/ +return ; }/*
Signature · 1 line
1.8.3.1
PATCH 10/20 staging: lustre: ldlm: restore interval_iterate_reverse function
In reply to James SimmonsEarlier the function interval_iterate_reverse function was removed since it wasn't used by anyone. Now it is being restored since it will be used by a future patch.
--- .../staging/lustre/lustre/include/interval_tree.h | 4 +++ drivers/staging/lustre/lustre/ldlm/interval_tree.c | 40 ++++++++++++++++++++++ 2 files changed, 44 insertions(+)
drivers/staging/lustre/lustre/include/interval_tree.h +4 -0
@@ -111,4 +111,8 @@ enum interval_iter interval_search(struct interval_node *root,struct interval_node_extent *ex, interval_callback_t func, void *data); +enum interval_iter interval_iterate_reverse (struct interval_node *root, +interval_callback_t func, +void *data); +#endif
drivers/staging/lustre/lustre/ldlm/interval_tree.c +40 -0
@@ -110,6 +110,15 @@ static struct interval_node *interval_first(struct interval_node *node)return node; } +static struct interval_node *interval_last (struct interval_node *node) +{ +if (!node) +return NULL ; +while (node->in_right) + node = node->in_right; +return node; +} +static struct interval_node *interval_next (struct interval_node *node) {if (!node)
@@ -121,6 +130,37 @@ static struct interval_node *interval_next(struct interval_node *node)return node->in_parent; } +static struct interval_node *interval_prev (struct interval_node *node) +{ +if (!node) +return NULL ; + +if (node->in_left) +return interval_last (node->in_left); + +while (node->in_parent &&node_is_left_child (node)) + node = node->in_parent; + +return node->in_parent; +} + +enum interval_iter interval_iterate_reverse (struct interval_node *root, +interval_callback_t func, +void *data) +{ +enum interval_iter rc =INTERVAL_ITER_CONT ; +struct interval_node *node; + +for (node =interval_last (root); node; node =interval_prev (node)) { + rc =func (node, data); +if (rc ==INTERVAL_ITER_STOP ) +break ; + } + +return rc; +} +EXPORT_SYMBOL (interval_iterate_reverse); +static void __rotate_change_maxhigh (struct interval_node *node,struct interval_node *rotate) {
Signature · 1 line
1.8.3.1
PATCH 11/20 staging: lustre: lustre: fix all less than 0 comparison for unsigned values
In reply to James SimmonsRemove all test of less than zero for unsigned values found with -Wtype-limits.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8843
Reviewed-on: https://review.whamcloud.com/23811
--- drivers/staging/lustre/lustre/include/cl_object.h | 2 +- drivers/staging/lustre/lustre/llite/rw.c | 2 +- drivers/staging/lustre/lustre/lov/lov_object.c | 8 ++++---- drivers/staging/lustre/lustre/mdc/lproc_mdc.c | 2 +- drivers/staging/lustre/lustre/osc/osc_cache.c | 7 ++++--- 5 files changed, 11 insertions(+), 10 deletions(-)
drivers/staging/lustre/lustre/include/cl_object.h +1 -1
@@ -1358,7 +1358,7 @@ struct cl_2queue {/** IO types */ enum cl_io_type {/** read system call */ -CIT_READ , +CIT_READ =1 ,/** write system call */ CIT_WRITE ,/** truncate, utime system calls */
drivers/staging/lustre/lustre/llite/rw.c +1 -1
@@ -115,7 +115,7 @@ void ll_ra_count_put(struct ll_sb_info *sbi, unsigned long len)static void ll_ra_stats_inc_sbi (struct ll_sb_info *sbi,enum ra_stat which) { -LASSERTF (which >=0 && which < _NR_RA_STAT,"which: %u\n" , which); +LASSERTF (which < _NR_RA_STAT,"which: %u\n" , which);lprocfs_counter_incr (sbi->ll_ra_stats, which); }
drivers/staging/lustre/lustre/lov/lov_object.c +4 -4
@@ -638,7 +638,7 @@ static int lov_attr_get_raid0(const struct lu_env *env, struct cl_object *obj,enum lov_layout_type __llt; \ \ __llt = __obj->lo_type; \ -LASSERT (0 <= __llt && __llt <ARRAY_SIZE (lov_dispatch)); \ +LASSERT (__llt <ARRAY_SIZE (lov_dispatch)); \ lov_dispatch[__llt].op (__VA_ARGS__); \ })
@@ -697,7 +697,7 @@ static inline void lov_conf_thaw(struct lov_object *lov) \lov_conf_freeze (__obj); \ __llt = __obj->lo_type; \ -LASSERT (0 <= __llt && __llt <ARRAY_SIZE (lov_dispatch)); \ +LASSERT (__llt <ARRAY_SIZE (lov_dispatch)); \ lov_dispatch[__llt].op (__VA_ARGS__); \lov_conf_thaw (__obj); \ }while (0 )
@@ -748,13 +748,13 @@ static int lov_layout_change(const struct lu_env *unused,u16 refcheck;int rc; -LASSERT (0 <= lov->lo_type && lov->lo_type <ARRAY_SIZE (lov_dispatch)); +LASSERT (lov->lo_type <ARRAY_SIZE (lov_dispatch)); env =cl_env_get (&refcheck);if (IS_ERR (env))return PTR_ERR (env); -LASSERT (0 <= llt && llt <ARRAY_SIZE (lov_dispatch)); +LASSERT (llt <ARRAY_SIZE (lov_dispatch)); CDEBUG(D_INODE, DFID " from %s to %s\n", PFID(lu_object_fid(lov2lu(lov))),
drivers/staging/lustre/lustre/mdc/lproc_mdc.c +1 -1
@@ -57,7 +57,7 @@ static ssize_t active_store(struct kobject *kobj, struct attribute *attr,if (rc)return rc; -if (val <0 || val >1 ) +if (val >1 )return -ERANGE ;/* opposite senses */
drivers/staging/lustre/lustre/osc/osc_cache.c +4 -3
@@ -783,6 +783,7 @@ static struct osc_extent *osc_extent_find(const struct lu_env *env,/* pull ext's start back to cover cur */ ext->oe_start = cur->oe_start; ext->oe_grants += chunksize; +LASSERT (*grants >= chunksize); *grants -= chunksize; found =osc_extent_hold (ext);
@@ -790,6 +791,7 @@ static struct osc_extent *osc_extent_find(const struct lu_env *env,/* rear merge */ ext->oe_end = cur->oe_end; ext->oe_grants += chunksize; +LASSERT (*grants >= chunksize); *grants -= chunksize;/* try to merge with the next one because we just fill
@@ -819,8 +821,8 @@ static struct osc_extent *osc_extent_find(const struct lu_env *env,/* create a new extent */ EASSERT (osc_extent_is_overlapped (obj, cur) ==0 , cur); cur->oe_grants = chunksize + cli->cl_extent_tax; +LASSERT (*grants >= cur->oe_grants); *grants -= cur->oe_grants; -LASSERT (*grants >=0 ); cur->oe_state =OES_CACHE ; found =osc_extent_hold (cur);
@@ -849,7 +851,6 @@ static struct osc_extent *osc_extent_find(const struct lu_env *env, out:osc_extent_put (env, cur); -LASSERT (*grants >=0 );return found; }
@@ -1219,8 +1220,8 @@ static int osc_extent_expand(struct osc_extent *ext, pgoff_t index, ext->oe_end = end_index; ext->oe_grants += chunksize; +LASSERT (*grants >= chunksize); *grants -= chunksize; -LASSERT (*grants >=0 );EASSERTF (osc_extent_is_overlapped (obj, ext) ==0 , ext,"overlapped after expanding for %lu.\n" , index);
Signature · 1 line
1.8.3.1
PATCH 12/20 staging: lustre: linkea: linkEA size limitation
In reply to James SimmonsFrom: Fan Yong <[email protected]>
Under DNE mode, if we do not restrict the linkEA size, and if there are too many cross-MDTs hard links to the same object, then it will cause the llog overflow. On the other hand, too many linkEA entries in the linkEA will serious affect the linkEA performance because we only support to locate linkEA entry consecutively.
So we need to restrict the linkEA size. Currently, it is 4096 bytes, that is independent from the backend. If too many hard links caused the linkEA overflowed, we will add overflow timestamp in the linkEA header.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8569
Reviewed-on: https://review.whamcloud.com/23500
--- .../lustre/lustre/include/lustre/lustre_idl.h | 5 +- .../staging/lustre/lustre/include/lustre_linkea.h | 15 ++++- drivers/staging/lustre/lustre/llite/llite_lib.c | 2 +- drivers/staging/lustre/lustre/obdclass/linkea.c | 69 +++++++++++++++++----- drivers/staging/lustre/lustre/ptlrpc/wiretest.c | 16 ++--- 5 files changed, 80 insertions(+), 27 deletions(-)
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +2 -3
@@ -3217,9 +3217,8 @@ struct link_ea_header {__u32 leh_magic;__u32 leh_reccount;__u64 leh_len;/* total size */ -/* future use */ -__u32 padding1; -__u32 padding2; +__u32 leh_overflow_time; +__u32 leh_padding; };/** Hardlink data is name and parent fid.
drivers/staging/lustre/lustre/include/lustre_linkea.h +14 -1
@@ -26,7 +26,19 @@* Author: di wang <[email protected]> */ -#define DEFAULT_LINKEA_SIZE 4096 +/* There are several reasons to restrict the linkEA size: +* +* 1. Under DNE mode, if we do not restrict the linkEA size, and if there +* are too many cross-MDTs hard links to the same object, then it will +* casue the llog overflow. +* +* 2. Some backend has limited size for EA. For example, if without large +* EA enabled, the ldiskfs will make all EAs to share one (4K) EA block. +* +* 3. Too many entries in linkEA will seriously affect linkEA performance +* because we only support to locate linkEA entry consecutively. +*/ +#define MAX_LINKEA_SIZE 4096struct linkea_data {/**
@@ -43,6 +55,7 @@ struct linkea_data {int linkea_data_new (struct linkea_data *ldata,struct lu_buf *buf);int linkea_init (struct linkea_data *ldata); +int linkea_init_with_rec (struct linkea_data *ldata);void linkea_entry_unpack (const struct link_ea_entry *lee,int *reclen,struct lu_name *lname,struct lu_fid *pfid); int linkea_entry_pack(struct link_ea_entry *lee, const struct lu_name *lname,
drivers/staging/lustre/lustre/llite/llite_lib.c +1 -1
@@ -2540,7 +2540,7 @@ static int ll_linkea_decode(struct linkea_data *ldata, unsigned int linkno,unsigned int idx;int rc; - rc =linkea_init (ldata); + rc =linkea_init_with_rec (ldata);if (rc <0 )return rc;
drivers/staging/lustre/lustre/obdclass/linkea.c +55 -14
123 lines not on this page · raw message
drivers/staging/lustre/lustre/ptlrpc/wiretest.c +8 -8
@@ -3820,14 +3820,14 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct link_ea_header, leh_len));LASSERTF ((int )sizeof (((struct link_ea_header *)0 )->leh_len) ==8 ,"found %lld\n" , (long long )(int )sizeof (((struct link_ea_header *)0 )->leh_len)); -LASSERTF ((int )offsetof(struct link_ea_header , padding1) ==16 ,"found %lld\n" , - (long long )(int )offsetof(struct link_ea_header , padding1)); -LASSERTF ((int )sizeof (((struct link_ea_header *)0 )->padding1) ==4 ,"found %lld\n" , - (long long )(int )sizeof (((struct link_ea_header *)0 )->padding1)); -LASSERTF ((int )offsetof(struct link_ea_header , padding2) ==20 ,"found %lld\n" , - (long long )(int )offsetof(struct link_ea_header , padding2)); -LASSERTF ((int )sizeof (((struct link_ea_header *)0 )->padding2) ==4 ,"found %lld\n" , - (long long )(int )sizeof (((struct link_ea_header *)0 )->padding2)); +LASSERTF ((int )offsetof(struct link_ea_header , leh_overflow_time) ==16 ,"found %lld\n" , + (long long )(int )offsetof(struct link_ea_header , leh_overflow_time)); +LASSERTF ((int )sizeof (((struct link_ea_header *)0 )->leh_overflow_time) ==4 ,"found %lld\n" , + (long long )(int )sizeof (((struct link_ea_header *)0 )->leh_overflow_time)); +LASSERTF ((int )offsetof(struct link_ea_header , leh_padding) ==20 ,"found %lld\n" , + (long long )(int )offsetof(struct link_ea_header , leh_padding)); +LASSERTF ((int )sizeof (((struct link_ea_header *)0 )->leh_padding) ==4 ,"found %lld\n" , + (long long )(int )sizeof (((struct link_ea_header *)0 )->leh_padding));BUILD_BUG_ON (LINK_EA_MAGIC !=0x11EAF1DFUL );/* Checks for struct link_ea_entry */
Signature · 1 line
1.8.3.1
PATCH 13/20 staging: lustre: ptlrpc: restore 64-bit time for struct ptlrpc_cli_req
In reply to James SimmonsDuring the reorganization of ptlrpc_request some of the time64_t fields were incorrectly turned into time_t. Restore those fields back to time_64_t.
Reviewed-on: https://review.whamcloud.com/24977
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4423
--- drivers/staging/lustre/lustre/include/lustre_net.h | 10 +++++----- drivers/staging/lustre/lustre/ptlrpc/client.c | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/staging/lustre/lustre/include/lustre_net.h +5 -5
@@ -558,13 +558,13 @@ struct ptlrpc_cli_req {/** request sent timeval */ struct timespec64 cr_sent_tv;/** time for request really sent out */ -time_t cr_sent_out; +time64_t cr_sent_out;/** when req reply unlink must finish. */ -time_t cr_reply_deadline; +time64_t cr_reply_deadline;/** when req bulk unlink must finish. */ -time_t cr_bulk_deadline; +time64_t cr_bulk_deadline;/** when req unlink must finish. */ -time_t cr_req_deadline; +time64_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 */
@@ -663,7 +663,7 @@ struct ptlrpc_srv_req {/** history sequence # */ __u64 sr_hist_seq;/** the index of service's srv_at_array into which request is linked */ -time_t sr_at_index; +time64_t sr_at_index;/** authed uid */ uid_t sr_auth_uid;/** authed uid mapped to */
drivers/staging/lustre/lustre/ptlrpc/client.c +1 -1
@@ -742,7 +742,7 @@ int ptlrpc_request_bufs_pack(struct ptlrpc_request *request,/* Let's setup deadline for req/reply/bulk unlink for opcode. */ if (cfs_fail_val == opcode) { -time_t *fail_t =NULL , *fail2_t =NULL ; +time64_t *fail_t =NULL , *fail2_t =NULL ;if (CFS_FAIL_CHECK (OBD_FAIL_PTLRPC_LONG_BULK_UNLINK )) { fail_t = &request->rq_bulk_deadline;
Signature · 1 line
1.8.3.1
PATCH 14/20 staging: lustre: ptlrpc: don't use CFS_DURATION_T for time64_t
In reply to James SimmonsThe libcfs CFS_DURATION_T define is really only for jiffies and its being used with time64_t in some of the ptlrpc code. Lets remove CFS_DURATION_T and replaced it with normal %lld instead.
Reviewed-on: https://review.whamcloud.com/24977
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4423
--- drivers/staging/lustre/lustre/ptlrpc/client.c | 5 ++--- drivers/staging/lustre/lustre/ptlrpc/service.c | 15 +++++++-------- 2 files changed, 9 insertions(+), 11 deletions(-)
drivers/staging/lustre/lustre/ptlrpc/client.c +2 -3
@@ -367,9 +367,8 @@ void ptlrpc_at_adj_net_latency(struct ptlrpc_request *req,*/ CDEBUG ((lustre_msg_get_flags (req->rq_reqmsg) &MSG_RESENT ) ?D_ADAPTTO :D_WARNING , -"Reported service time %u > total measured time " CFS_DURATION_T "\n" , - service_time, - (long )(now - req->rq_sent)); +"Reported service time %u > total measured time %lld\n" , + service_time, now - req->rq_sent);return ; }
drivers/staging/lustre/lustre/ptlrpc/service.c +7 -8
@@ -1565,9 +1565,9 @@ static bool ptlrpc_server_normal_pending(struct ptlrpc_service_part *svcpt,/* req_in handling should/must be fast */ if (ktime_get_real_seconds () - req->rq_arrival_time.tv_sec >5 ) -DEBUG_REQ (D_WARNING , req,"Slow req_in handling " CFS_DURATION_T "s" , - (long )(ktime_get_real_seconds () - - req->rq_arrival_time.tv_sec)); +DEBUG_REQ (D_WARNING , req,"Slow req_in handling %llds" , + (s64)(ktime_get_real_seconds () - + req->rq_arrival_time.tv_sec));/* Set rpc server deadline and add it to the timed list */ deadline = (lustre_msghdr_get_flags(req->rq_reqmsg) &
@@ -1674,12 +1674,11 @@ static bool ptlrpc_server_normal_pending(struct ptlrpc_service_part *svcpt,* The deadline is increased if we send an early reply. */ if (ktime_get_real_seconds () > request->rq_deadline) { -DEBUG_REQ (D_ERROR , request,"Dropping timed-out request from %s: deadline " CFS_DURATION_T ":" CFS_DURATION_T "s ago\n" , +DEBUG_REQ (D_ERROR , request,"Dropping timed-out request from %s: deadline %lld:%llds ago\n" ,libcfs_id2str (request->rq_peer), - (long )(request->rq_deadline - - request->rq_arrival_time.tv_sec), - (long )(ktime_get_real_seconds () - - request->rq_deadline)); + request->rq_deadline - + request->rq_arrival_time.tv_sec, +ktime_get_real_seconds () - request->rq_deadline); goto put_conn; }
Signature · 1 line
1.8.3.1
PATCH 15/20 staging: lustre: ptlrpc: print times in microseconds
In reply to James SimmonsFrom: Bob Glosman <[email protected]>
report times and time diffs in seconds.microseconds instead of seconds
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7733
Reviewed-on: http://review.whamcloud.com/18335
--- drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c +12 -3
@@ -905,11 +905,18 @@ static int ptlrpc_lprocfs_svc_req_history_show(struct seq_file *s, void *iter) rc =ptlrpc_lprocfs_svc_req_history_seek (svcpt, srhi, srhi->srhi_seq);if (rc ==0 ) { +struct timespec64 arrival, sent, arrivaldiff;char nidstr[LNET_NIDSTR_SIZE ]; req = srhi->srhi_req;libcfs_nid2str_r (req->rq_self, nidstr,sizeof (nidstr)); + arrival.tv_sec = req->rq_arrival_time.tv_sec; + arrival.tv_nsec = req->rq_arrival_time.tv_nsec; + sent.tv_sec = req->rq_sent; + sent.tv_nsec =0 ; + arrivaldiff =timespec64_sub (sent, arrival); +/* Print common req fields. * CAVEAT EMPTOR: we're racing with the service handler * here. The request could contain any old crap, so you
@@ -917,13 +924,15 @@ static int ptlrpc_lprocfs_svc_req_history_show(struct seq_file *s, void *iter)* parser. Currently I only print stuff here I know is OK * to look at coz it was set up in request_in_callback()!!! */ -seq_printf (s,"%lld:%s:%s:x%llu:%d:%s:%lld:%lds(%+lds) " , +seq_printf (s,"%lld:%s:%s:x%llu:%d:%s:%lld.%06lld:%lld.%06llds(%+lld.0s) " , req->rq_history_seq, nidstr,libcfs_id2str (req->rq_peer), req->rq_xid, req->rq_reqlen,ptlrpc_rqphase2str (req), (s64 )req->rq_arrival_time.tv_sec, - (long )(req->rq_sent - req->rq_arrival_time.tv_sec), - (long )(req->rq_sent - req->rq_deadline)); + (s64 )req->rq_arrival_time.tv_nsec /NSEC_PER_USEC , + (s64 )arrivaldiff.tv_sec, + (s64)(arrivaldiff.tv_nsec /NSEC_PER_USEC ), + (s64)(req->rq_sent - req->rq_deadline));if (!svc->srv_ops.so_req_printer)seq_putc (s,'\n' );else
Signature · 1 line
1.8.3.1
PATCH 16/20 staging: lustre: libcfs: fix test for libcfs_ioctl_hdr minimum size
In reply to James SimmonsThe function libcfs_ioctl_getdata() test to see if libcfs_ioctl_hdr is smaller than struct libcfs_ioctl_data in size. This is wrong and it breaks the ioctl that is used to collect LNet stats. The correct size to compare against is struct libcfs_ioctl_hdr.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5935
Reviewed-on: http://review.whamcloud.com/12782
--- drivers/staging/lustre/lnet/libcfs/linux/linux-module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lnet/libcfs/linux/linux-module.c +1 -1
@@ -134,7 +134,7 @@ int libcfs_ioctl_getdata(struct libcfs_ioctl_hdr **hdr_pp,return -EINVAL ; } -if (hdr.ioc_len <sizeof (struct libcfs_ioctl_data )) { +if (hdr.ioc_len <sizeof (hdr)) {CERROR ("libcfs ioctl: user buffer too small for ioctl\n" );return -EINVAL ; }
Signature · 1 line
1.8.3.1
PATCH 17/20 staging: lustre: llite: allow cached acls
In reply to James SimmonsFrom: Dmitry Eremin <[email protected]>
Move the freeing of all cached acls from ll_get_acl() to the function ll_clear_inode(). This way we free all cached acls for the inode just before clearing it. This allow us to take advantage of cached acls and correctly free them before free.
Reviewed-on: https://review.whamcloud.com/25965
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-9183
--- drivers/staging/lustre/lustre/llite/file.c | 3 --- drivers/staging/lustre/lustre/llite/llite_lib.c | 1 + 2 files changed, 1 insertion(+), 3 deletions(-)
drivers/staging/lustre/lustre/llite/file.c +0 -3
@@ -3035,9 +3035,6 @@ struct posix_acl *ll_get_acl(struct inode *inode, int type)spin_lock (&lli->lli_lock);/* VFS' acl_permission_check->check_acl will release the refcount */ acl =posix_acl_dup (lli->lli_posix_acl); -#ifdef CONFIG_FS_POSIX_ACL -forget_cached_acl (inode, type); -#endif spin_unlock (&lli->lli_lock);return acl;
drivers/staging/lustre/lustre/llite/llite_lib.c +1 -0
@@ -1316,6 +1316,7 @@ void ll_clear_inode(struct inode *inode)ll_xattr_cache_destroy (inode);#ifdef CONFIG_FS_POSIX_ACL +forget_all_cached_acls (inode);if (lli->lli_posix_acl) {posix_acl_release (lli->lli_posix_acl); lli->lli_posix_acl =NULL ;
Signature · 1 line
1.8.3.1
PATCH 18/20 staging: lustre: llite: Remove filtering of seclabel xattr
In reply to James SimmonsFrom: Robin Humble <[email protected]>
The security.capability xattr is used to implement File Capabilities in recent Linux versions. Capabilities are a fine grained approach to granting executables elevated privileges. eg. /bin/ping can have capabilities cap_net_admin, cap_net_raw+ep instead of being setuid root.
This xattr has long been filtered out by llite, initially for stability reasons (b15587), and later over performance concerns as this xattr is read for every file with eg. 'ls --color'. Since LU-2869 xattr's are cached on clients, alleviating most performance concerns.
Removing llite's filtering of the security.capability xattr enables using Lustre as a root filesystem, which is used on some large clusters.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-9562
Reviewed-on: https://review.whamcloud.com/27292
--- drivers/staging/lustre/lustre/llite/file.c | 58 ++++++++++++++++++++++ .../staging/lustre/lustre/llite/llite_internal.h | 4 ++ drivers/staging/lustre/lustre/llite/namei.c | 6 +++ 3 files changed, 68 insertions(+)
drivers/staging/lustre/lustre/llite/file.c +58 -0
@@ -3040,6 +3040,61 @@ struct posix_acl *ll_get_acl(struct inode *inode, int type)return acl; } +#ifdef CONFIG_FS_POSIX_ACL +int ll_set_acl (struct inode *inode,struct posix_acl *acl,int type) +{ +const char *name =NULL ; +char *value =NULL ; +size_t size =0 ; +int rc =0 ; + +switch (type) { +case ACL_TYPE_ACCESS : +if (acl) { + rc =posix_acl_update_mode (inode, &inode->i_mode, &acl); +if (rc) + goto out; + } + name =XATTR_NAME_POSIX_ACL_ACCESS ; +break ; +case ACL_TYPE_DEFAULT : +if (!S_ISDIR (inode->i_mode)) { + rc = acl ? -EACCES :0 ; + goto out; + } + name =XATTR_NAME_POSIX_ACL_DEFAULT ; +break ; +default : + rc = -EINVAL ; + goto out; + } + +if (acl) { + size =posix_acl_xattr_size (acl->a_count); + value =kmalloc (size,GFP_NOFS ); +if (!value) { + rc = -ENOMEM ; + goto out; + } + + rc =posix_acl_to_xattr (&init_user_ns, acl, value, size); +if (rc <0 ) + goto out_free; + } + +/* dentry is only used for *.lov attributes so it's safe to be NULL */ + rc =__vfs_setxattr (NULL , inode, name, value, size,XATTR_CREATE ); +out_free: +kfree (value); +out: +if (!rc) +set_cached_acl (inode, type, acl); +else +forget_cached_acl (inode, type); +return rc; +} +#endif /* CONFIG_FS_POSIX_ACL */ +int ll_inode_permission (struct inode *inode,int mask) {struct ll_sb_info *sbi;
@@ -3162,6 +3217,9 @@ int ll_inode_permission(struct inode *inode, int mask) .listxattr = ll_listxattr, .fiemap = ll_fiemap, .get_acl = ll_get_acl, +#ifdef CONFIG_FS_POSIX_ACL + .set_acl = ll_set_acl, +#endif };/* dynamic ioctl number support routines */
drivers/staging/lustre/lustre/llite/llite_internal.h +4 -0
@@ -752,6 +752,10 @@ enum ldlm_mode ll_take_md_lock(struct inode *inode, __u64 bits,int ll_getattr (const struct path *path,struct kstat *stat,u32 request_mask,unsigned int flags);struct posix_acl *ll_get_acl (struct inode *inode,int type); +#ifdef CONFIG_FS_POSIX_ACL +int ll_set_acl (struct inode *inode,struct posix_acl *acl,int type); +#endif /* CONFIG_FS_POSIX_ACL */ +int ll_migrate (struct inode *parent,struct file *file,int mdtidx,const char *name,int namelen); int ll_get_fid_by_name(struct inode *parent, const char *name,
drivers/staging/lustre/lustre/llite/namei.c +6 -0
@@ -1187,6 +1187,9 @@ static int ll_rename(struct inode *src, struct dentry *src_dchild, .permission = ll_inode_permission, .listxattr = ll_listxattr, .get_acl = ll_get_acl, +#ifdef CONFIG_FS_POSIX_ACL + .set_acl = ll_set_acl, +#endif };const struct inode_operations ll_special_inode_operations = {
@@ -1195,4 +1198,7 @@ static int ll_rename(struct inode *src, struct dentry *src_dchild, .permission = ll_inode_permission, .listxattr = ll_listxattr, .get_acl = ll_get_acl, +#ifdef CONFIG_FS_POSIX_ACL + .set_acl = ll_set_acl, +#endif };
Signature · 1 line
1.8.3.1
PATCH 18/20 staging: lustre: llite: Remove filtering of seclabel xattr
Hi James,
sorry, but this isn't my patch.
I deleted a couple of lines from xattr.c, not the below.
I think you might have got the wrong commit comment somehow?
I took lkml etc. out of the CC 'cos I'm not subscribed there.
cheers,
robin
Quoted 151 lines · James Simmons
From: Robin Humble <[email protected]>
The security.capability xattr is used to implement File Capabilities in recent Linux versions. Capabilities are a fine grained approach to granting executables elevated privileges. eg.
/bin/pingcan have capabilitiescap_net_admin, cap_net_raw+ep instead of being setuid root.This xattr has long been filtered out by llite, initially for stability reasons (b15587), and later over performance concerns as this xattr is read for every file with eg. 'ls --color'. Since LU-2869 xattr's are cached on clients, alleviating most performance concerns.
Removing llite's filtering of the security.capability xattr enables using Lustre as a root filesystem, which is used on some large clusters.
Signed-off-by Robin Humble <[email protected]>Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-9562
Reviewed-on: https://review.whamcloud.com/27292Reviewed-by John L. Hammond <[email protected]>Reviewed-by Sebastien Buisson <[email protected]>Reviewed-by Oleg Drokin <[email protected]>Signed-off-by James Simmons <[email protected]>---
drivers/staging/lustre/lustre/llite/file.c | 58 ++++++++++++++++++++++ .../staging/lustre/lustre/llite/llite_internal.h | 4 ++ drivers/staging/lustre/lustre/llite/namei.c | 6 +++ 3 files changed, 68 insertions(+)drivers/staging/lustre/lustre/llite/file.c +58
-0@@ -3040,6 +3040,61 @@ struct posix_acl *ll_get_acl(struct inode *inode, int type)return acl; } +#ifdef CONFIG_FS_POSIX_ACL +int ll_set_acl (struct inode *inode,struct posix_acl *acl,int type) +{ +const char *name =NULL ; +char *value =NULL ; +size_t size =0 ; +int rc =0 ; + +switch (type) { +case ACL_TYPE_ACCESS : +if (acl) { + rc =posix_acl_update_mode (inode, &inode->i_mode, &acl); +if (rc) + goto out; + } + name =XATTR_NAME_POSIX_ACL_ACCESS ; +break ; +case ACL_TYPE_DEFAULT : +if (!S_ISDIR (inode->i_mode)) { + rc = acl ? -EACCES :0 ; + goto out; + } + name =XATTR_NAME_POSIX_ACL_DEFAULT ; +break ; +default : + rc = -EINVAL ; + goto out; + } + +if (acl) { + size =posix_acl_xattr_size (acl->a_count); + value =kmalloc (size,GFP_NOFS ); +if (!value) { + rc = -ENOMEM ; + goto out; + } + + rc =posix_acl_to_xattr (&init_user_ns, acl, value, size); +if (rc <0 ) + goto out_free; + } + +/* dentry is only used for *.lov attributes so it's safe to be NULL */ + rc =__vfs_setxattr (NULL , inode, name, value, size,XATTR_CREATE ); +out_free: +kfree (value); +out: +if (!rc) +set_cached_acl (inode, type, acl); +else +forget_cached_acl (inode, type); +return rc; +} +#endif /* CONFIG_FS_POSIX_ACL */ +int ll_inode_permission (struct inode *inode,int mask) {struct ll_sb_info *sbi;@@ -3162,6 +3217,9 @@ int ll_inode_permission(struct inode *inode, int mask) .listxattr = ll_listxattr, .fiemap = ll_fiemap, .get_acl = ll_get_acl, +#ifdef CONFIG_FS_POSIX_ACL + .set_acl = ll_set_acl, +#endif };/* dynamic ioctl number support routines */ drivers/staging/lustre/lustre/llite/llite_internal.h +4
-0@@ -752,6 +752,10 @@ enum ldlm_mode ll_take_md_lock(struct inode *inode, __u64 bits,int ll_getattr (const struct path *path,struct kstat *stat,u32 request_mask,unsigned int flags);struct posix_acl *ll_get_acl (struct inode *inode,int type); +#ifdef CONFIG_FS_POSIX_ACL +int ll_set_acl (struct inode *inode,struct posix_acl *acl,int type); +#endif /* CONFIG_FS_POSIX_ACL */ +int ll_migrate (struct inode *parent,struct file *file,int mdtidx,const char *name,int namelen); int ll_get_fid_by_name(struct inode *parent, const char *name,drivers/staging/lustre/lustre/llite/namei.c +6
-0@@ -1187,6 +1187,9 @@ static int ll_rename(struct inode *src, struct dentry *src_dchild, .permission = ll_inode_permission, .listxattr = ll_listxattr, .get_acl = ll_get_acl, +#ifdef CONFIG_FS_POSIX_ACL + .set_acl = ll_set_acl, +#endif };const struct inode_operations ll_special_inode_operations = {@@ -1195,4 +1198,7 @@ static int ll_rename(struct inode *src, struct dentry *src_dchild, .permission = ll_inode_permission, .listxattr = ll_listxattr, .get_acl = ll_get_acl, +#ifdef CONFIG_FS_POSIX_ACL + .set_acl = ll_set_acl, +#endif };Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list lustre-devel at lists.lustre.org http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 18/20 staging: lustre: llite: Remove filtering of seclabel xattr
Quoted 9 lines
Hi James,
sorry, but this isn't my patch.
I deleted a couple of lines fromxattr.c, not the below.I think you might have got the wrong commit comment somehow?
I took lkml etc. out of the CC 'cos I'm not subscribed there.
I sent the email. Sorry about the mix up.
Quoted 156 lines
cheers,
robinQuoted 151 lines · James Simmons
From: Robin Humble <[email protected]>
The security.capability xattr is used to implement File Capabilities in recent Linux versions. Capabilities are a fine grained approach to granting executables elevated privileges. eg.
/bin/pingcan have capabilitiescap_net_admin, cap_net_raw+ep instead of being setuid root.This xattr has long been filtered out by llite, initially for stability reasons (b15587), and later over performance concerns as this xattr is read for every file with eg. 'ls --color'. Since LU-2869 xattr's are cached on clients, alleviating most performance concerns.
Removing llite's filtering of the security.capability xattr enables using Lustre as a root filesystem, which is used on some large clusters.
Signed-off-by Robin Humble <[email protected]>Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-9562
Reviewed-on: https://review.whamcloud.com/27292Reviewed-by John L. Hammond <[email protected]>Reviewed-by Sebastien Buisson <[email protected]>Reviewed-by Oleg Drokin <[email protected]>Signed-off-by James Simmons <[email protected]>---
drivers/staging/lustre/lustre/llite/file.c | 58 ++++++++++++++++++++++ .../staging/lustre/lustre/llite/llite_internal.h | 4 ++ drivers/staging/lustre/lustre/llite/namei.c | 6 +++ 3 files changed, 68 insertions(+)drivers/staging/lustre/lustre/llite/file.c +58
-0@@ -3040,6 +3040,61 @@ struct posix_acl *ll_get_acl(struct inode *inode, int type)return acl; } +#ifdef CONFIG_FS_POSIX_ACL +int ll_set_acl (struct inode *inode,struct posix_acl *acl,int type) +{ +const char *name =NULL ; +char *value =NULL ; +size_t size =0 ; +int rc =0 ; + +switch (type) { +case ACL_TYPE_ACCESS : +if (acl) { + rc =posix_acl_update_mode (inode, &inode->i_mode, &acl); +if (rc) + goto out; + } + name =XATTR_NAME_POSIX_ACL_ACCESS ; +break ; +case ACL_TYPE_DEFAULT : +if (!S_ISDIR (inode->i_mode)) { + rc = acl ? -EACCES :0 ; + goto out; + } + name =XATTR_NAME_POSIX_ACL_DEFAULT ; +break ; +default : + rc = -EINVAL ; + goto out; + } + +if (acl) { + size =posix_acl_xattr_size (acl->a_count); + value =kmalloc (size,GFP_NOFS ); +if (!value) { + rc = -ENOMEM ; + goto out; + } + + rc =posix_acl_to_xattr (&init_user_ns, acl, value, size); +if (rc <0 ) + goto out_free; + } + +/* dentry is only used for *.lov attributes so it's safe to be NULL */ + rc =__vfs_setxattr (NULL , inode, name, value, size,XATTR_CREATE ); +out_free: +kfree (value); +out: +if (!rc) +set_cached_acl (inode, type, acl); +else +forget_cached_acl (inode, type); +return rc; +} +#endif /* CONFIG_FS_POSIX_ACL */ +int ll_inode_permission (struct inode *inode,int mask) {struct ll_sb_info *sbi;@@ -3162,6 +3217,9 @@ int ll_inode_permission(struct inode *inode, int mask) .listxattr = ll_listxattr, .fiemap = ll_fiemap, .get_acl = ll_get_acl, +#ifdef CONFIG_FS_POSIX_ACL + .set_acl = ll_set_acl, +#endif };/* dynamic ioctl number support routines */ drivers/staging/lustre/lustre/llite/llite_internal.h +4
-0@@ -752,6 +752,10 @@ enum ldlm_mode ll_take_md_lock(struct inode *inode, __u64 bits,int ll_getattr (const struct path *path,struct kstat *stat,u32 request_mask,unsigned int flags);struct posix_acl *ll_get_acl (struct inode *inode,int type); +#ifdef CONFIG_FS_POSIX_ACL +int ll_set_acl (struct inode *inode,struct posix_acl *acl,int type); +#endif /* CONFIG_FS_POSIX_ACL */ +int ll_migrate (struct inode *parent,struct file *file,int mdtidx,const char *name,int namelen); int ll_get_fid_by_name(struct inode *parent, const char *name,drivers/staging/lustre/lustre/llite/namei.c +6
-0@@ -1187,6 +1187,9 @@ static int ll_rename(struct inode *src, struct dentry *src_dchild, .permission = ll_inode_permission, .listxattr = ll_listxattr, .get_acl = ll_get_acl, +#ifdef CONFIG_FS_POSIX_ACL + .set_acl = ll_set_acl, +#endif };const struct inode_operations ll_special_inode_operations = {@@ -1195,4 +1198,7 @@ static int ll_rename(struct inode *src, struct dentry *src_dchild, .permission = ll_inode_permission, .listxattr = ll_listxattr, .get_acl = ll_get_acl, +#ifdef CONFIG_FS_POSIX_ACL + .set_acl = ll_set_acl, +#endif };Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list lustre-devel at lists.lustre.org http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
Re: [PATCH 18/20] staging: lustre: llite: Remove filtering of seclabel xattr
In reply to James SimmonsQuoted 15 lines
From: Robin Humble <[email protected]>
The security.capability xattr is used to implement File Capabilities in recent Linux versions. Capabilities are a fine grained approach to granting executables elevated privileges. eg.
/bin/pingcan have capabilitiescap_net_admin, cap_net_raw+ep instead of being setuid root.This xattr has long been filtered out by llite, initially for stability reasons (b15587), and later over performance concerns as this xattr is read for every file with eg. 'ls --color'. Since LU-2869 xattr's are cached on clients, alleviating most performance concerns.
Quoted 3 lines
Removing llite's filtering of the security.capability xattr enables using Lustre as a root filesystem, which is used on some large clusters.
The commit message for this patch is incorrect. Some how it got mixed up with another patch which I missed in this push. Please drop this patch and I will resent the correct patches later.
Quoted 130 lines
Signed-off-by Robin Humble <[email protected]>Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-9562
Reviewed-on: https://review.whamcloud.com/27292Reviewed-by John L. Hammond <[email protected]>Reviewed-by Sebastien Buisson <[email protected]>Reviewed-by Oleg Drokin <[email protected]>Signed-off-by James Simmons <[email protected]>--- drivers/staging/lustre/lustre/llite/file.c | 58 ++++++++++++++++++++++ .../staging/lustre/lustre/llite/llite_internal.h | 4 ++ drivers/staging/lustre/lustre/llite/namei.c | 6 +++ 3 files changed, 68 insertions(+)drivers/staging/lustre/lustre/llite/file.c +58
-0@@ -3040,6 +3040,61 @@ struct posix_acl *ll_get_acl(struct inode *inode, int type)return acl; } +#ifdef CONFIG_FS_POSIX_ACL +int ll_set_acl (struct inode *inode,struct posix_acl *acl,int type) +{ +const char *name =NULL ; +char *value =NULL ; +size_t size =0 ; +int rc =0 ; + +switch (type) { +case ACL_TYPE_ACCESS : +if (acl) { + rc =posix_acl_update_mode (inode, &inode->i_mode, &acl); +if (rc) + goto out; + } + name =XATTR_NAME_POSIX_ACL_ACCESS ; +break ; +case ACL_TYPE_DEFAULT : +if (!S_ISDIR (inode->i_mode)) { + rc = acl ? -EACCES :0 ; + goto out; + } + name =XATTR_NAME_POSIX_ACL_DEFAULT ; +break ; +default : + rc = -EINVAL ; + goto out; + } + +if (acl) { + size =posix_acl_xattr_size (acl->a_count); + value =kmalloc (size,GFP_NOFS ); +if (!value) { + rc = -ENOMEM ; + goto out; + } + + rc =posix_acl_to_xattr (&init_user_ns, acl, value, size); +if (rc <0 ) + goto out_free; + } + +/* dentry is only used for *.lov attributes so it's safe to be NULL */ + rc =__vfs_setxattr (NULL , inode, name, value, size,XATTR_CREATE ); +out_free: +kfree (value); +out: +if (!rc) +set_cached_acl (inode, type, acl); +else +forget_cached_acl (inode, type); +return rc; +} +#endif /* CONFIG_FS_POSIX_ACL */ +int ll_inode_permission (struct inode *inode,int mask) {struct ll_sb_info *sbi;@@ -3162,6 +3217,9 @@ int ll_inode_permission(struct inode *inode, int mask) .listxattr = ll_listxattr, .fiemap = ll_fiemap, .get_acl = ll_get_acl, +#ifdef CONFIG_FS_POSIX_ACL + .set_acl = ll_set_acl, +#endif };/* dynamic ioctl number support routines */ drivers/staging/lustre/lustre/llite/llite_internal.h +4
-0@@ -752,6 +752,10 @@ enum ldlm_mode ll_take_md_lock(struct inode *inode, __u64 bits,int ll_getattr (const struct path *path,struct kstat *stat,u32 request_mask,unsigned int flags);struct posix_acl *ll_get_acl (struct inode *inode,int type); +#ifdef CONFIG_FS_POSIX_ACL +int ll_set_acl (struct inode *inode,struct posix_acl *acl,int type); +#endif /* CONFIG_FS_POSIX_ACL */ +int ll_migrate (struct inode *parent,struct file *file,int mdtidx,const char *name,int namelen); int ll_get_fid_by_name(struct inode *parent, const char *name,drivers/staging/lustre/lustre/llite/namei.c +6
-0@@ -1187,6 +1187,9 @@ static int ll_rename(struct inode *src, struct dentry *src_dchild, .permission = ll_inode_permission, .listxattr = ll_listxattr, .get_acl = ll_get_acl, +#ifdef CONFIG_FS_POSIX_ACL + .set_acl = ll_set_acl, +#endif };const struct inode_operations ll_special_inode_operations = {@@ -1195,4 +1198,7 @@ static int ll_rename(struct inode *src, struct dentry *src_dchild, .permission = ll_inode_permission, .listxattr = ll_listxattr, .get_acl = ll_get_acl, +#ifdef CONFIG_FS_POSIX_ACL + .set_acl = ll_set_acl, +#endif };Signature · 1 line
1.8.3.1
Greg Kroah-Hartman
maintainerRe: [PATCH 18/20] staging: lustre: llite: Remove filtering of seclabel xattr
Quoted 15 lines · James Simmons
Quoted 15 lines
From: Robin Humble <[email protected]>
The security.capability xattr is used to implement File Capabilities in recent Linux versions. Capabilities are a fine grained approach to granting executables elevated privileges. eg.
/bin/pingcan have capabilitiescap_net_admin, cap_net_raw+ep instead of being setuid root.This xattr has long been filtered out by llite, initially for stability reasons (b15587), and later over performance concerns as this xattr is read for every file with eg. 'ls --color'. Since LU-2869 xattr's are cached on clients, alleviating most performance concerns.
Quoted 7 lines
Quoted 3 lines
Removing llite's filtering of the security.capability xattr enables using Lustre as a root filesystem, which is used on some large clusters.
The commit message for this patch is incorrect. Some how it got mixed up with another patch which I missed in this push. Please drop this patch and I will resent the correct patches later.
Now dropped.
PATCH 19/20 staging: lustre: llite: add xattr.h header to xattr.c
In reply to James SimmonsFrom: Dmitry Eremin <[email protected]>
The reason xattr.c can compile without xattr.h is due to lustre_compact.h being included. That header will eventually go away so lets directly include xattr.h.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7244
Reviewed-on: http://review.whamcloud.com/16707
--- drivers/staging/lustre/lustre/llite/xattr.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/lustre/lustre/llite/xattr.c +1 -0
@@ -33,6 +33,7 @@#include <linux/fs.h> #include <linux/sched.h> #include <linux/mm.h> +#include <linux/xattr.h> #include <linux/selinux.h> #define DEBUG_SUBSYSTEM S_LLITE
Signature · 1 line
1.8.3.1
PATCH 20/20 staging: lustre: llite: set security xattr using __vfs_setxattr
In reply to James SimmonsCurrently ll_initxattrs() initializes the security xattrs in a very non-standard using get_xattr_types() to get the struct handler that lustre created to then call indirectly the function to set the xattr. The available __vfs_setxattr() function does the same thing and also handles the case of when size is zero the xattr should be set to empty EA.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-9183
Reviewed-on: https://review.whamcloud.com/27240
--- .../staging/lustre/lustre/llite/xattr_security.c | 23 ++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-)
drivers/staging/lustre/lustre/llite/xattr_security.c +15 -8
@@ -28,7 +28,10 @@* lustre/llite/xattr_security.c * Handler for storing security labels as extended attributes. */ + +#include <linux/types.h> #include <linux/security.h> +#include <linux/selinux.h> #include <linux/xattr.h> #include "llite_internal.h"
@@ -48,19 +51,23 @@ ll_initxattrs(struct inode *inode, const struct xattr *xattr_array, void *fs_info) { - const struct xattr_handler *handler; struct dentry *dentry = fs_info;const struct xattr *xattr;int err =0 ; - handler =get_xattr_type (XATTR_SECURITY_PREFIX ); -if (!handler) -return -ENXIO ; -for (xattr = xattr_array; xattr->name; xattr++) { - err = handler->set (handler, dentry, inode, xattr->name, - xattr->value, xattr->value_len, -XATTR_CREATE ); +char *full_name; + + full_name =kasprintf (GFP_KERNEL ,"%s%s" , +XATTR_SECURITY_PREFIX , xattr->name); +if (!full_name) { + err = -ENOMEM ; +break ; + } + + err =__vfs_setxattr (dentry, inode, full_name, xattr->value, + xattr->value_len,XATTR_CREATE ); +kfree (full_name);if (err <0 )break ; }
Signature · 1 line
1.8.3.1