lustre: first batch of fixes from lustre 2.10
cover lustre: first batch of fixes from lustre 2.10
First collection of patches to address various cleanups and bugs in the lustre 2.10 release that are missing for the lustre linux client. These patches can be applied in any order.
Alexander Boyko (2):
lustre: osc: fix for cl_env_get in low memory
lustre: ptlrpc: fix wrong error handlers
Alexandr Boyko (1):
lustre: osc: adds radix_tree_preload
Andreas Dilger (2):
lustre: llog: update llog print format to use FIDs
lustre: mdc: allow setting readdir RPC size parameter
Andrew Perepechko (1):
lustre: llite: llite.stat_blocksize param for fixed st_blksize
Andriy Skulysh (3):
lustre: osc: GPF while doing ELC with no_wait_policy
lustre: ldlm: GPF in _ldlm_lock_debug()
lustre: llite: protect ll_dentry_data modification
Bobi Jam (2):
lustre: osc: osc page lru list race
lustre: llite: check the return value of cl_file_inode_init()
Bruno Faccini (1):
lustre: ptlrpc: drain "ptlrpc_request_buffer_desc" objects
Doug Oucharek (1):
lustre: lnet: Change sock_create() to sock_create_kern()
Fan Yong (1):
lustre: ptlrpc: free reply buffer earlier for open RPC
James Simmons (2):
lustre: lnd: resolve IP query code in LND drivers
lustre: clio: fix spare bit handling
John L. Hammond (3):
lustre: ptlrpc: set rq_sent when send fails due to -ENOMEM
lustre: kuc: initialize kkuc_groups at module init time
lustre: ldlm: use static initializer macros where possible
Niu Yawei (3):
lustre: uapi: add documentation about FIDs
lustre: osc: update timestamps on write only
lustre: ptlrpc: add replay request into unreplied list
Patrick Farrell (1):
lustre: ldlm: cond_resched in ldlm_bl_thread_main
Sebastien Buisson (1):
lustre: llite: set sec ctx on client's inode at create time
Steve Guminski (3):
lustre: ptlrpc: Prevent possible dereference of NULL pointers
lustre: mgc: Remove unnecessary checks for config_log_put()
lustre: llite: rcu-walk check should not depend on statahead
Vitaly Fertman (1):
lustre: ptlrpc: increase sleep time in ptlrpc_request_bufs_pack()
Wang Shilong (1):
lustre: obd: remove obsolete OBD_FL_LOCAL_MASK
Yang Sheng (1):
lustre: libcfs: use save_stack_trace for stack dump
.../lustre/include/linux/libcfs/libcfs_debug.h | 1 + .../lustre/include/uapi/linux/lustre/lustre_idl.h | 88 +++++++++++++++++++++- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 12 ++- .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 2 +- drivers/staging/lustre/lnet/libcfs/debug.c | 46 ++++++++++- drivers/staging/lustre/lnet/lnet/lib-socket.c | 2 +- .../staging/lustre/lustre/include/lprocfs_status.h | 5 ++ drivers/staging/lustre/lustre/include/lustre_dlm.h | 4 +- .../lustre/lustre/include/lustre_kernelcomm.h | 1 + drivers/staging/lustre/lustre/include/lustre_net.h | 14 ++-- drivers/staging/lustre/lustre/include/obd.h | 5 +- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 13 +++- drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 12 +-- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 6 +- drivers/staging/lustre/lustre/llite/dcache.c | 7 +- drivers/staging/lustre/lustre/llite/dir.c | 22 +++--- drivers/staging/lustre/lustre/llite/file.c | 2 +- drivers/staging/lustre/lustre/llite/lcommon_cl.c | 19 ++--- .../staging/lustre/lustre/llite/llite_internal.h | 8 +- drivers/staging/lustre/lustre/llite/llite_lib.c | 24 +++--- drivers/staging/lustre/lustre/llite/llite_nfs.c | 4 +- drivers/staging/lustre/lustre/llite/lproc_llite.c | 33 ++++++++ drivers/staging/lustre/lustre/llite/namei.c | 59 ++++++++++++--- drivers/staging/lustre/lustre/llite/statahead.c | 4 - drivers/staging/lustre/lustre/mdc/lproc_mdc.c | 20 +---- drivers/staging/lustre/lustre/mdc/mdc_request.c | 35 ++++++--- drivers/staging/lustre/lustre/mgc/mgc_request.c | 36 ++++----- drivers/staging/lustre/lustre/obdclass/class_obd.c | 3 + .../staging/lustre/lustre/obdclass/kernelcomm.c | 38 +++++++--- drivers/staging/lustre/lustre/obdclass/llog_cat.c | 28 +++---- drivers/staging/lustre/lustre/obdclass/llog_swab.c | 4 +- .../lustre/lustre/obdclass/lprocfs_status.c | 54 +++++++++++++ drivers/staging/lustre/lustre/obdclass/obdo.c | 11 --- drivers/staging/lustre/lustre/osc/lproc_osc.c | 46 ----------- drivers/staging/lustre/lustre/osc/osc_cache.c | 3 + drivers/staging/lustre/lustre/osc/osc_io.c | 2 +- drivers/staging/lustre/lustre/osc/osc_lock.c | 13 +++- drivers/staging/lustre/lustre/osc/osc_object.c | 2 +- drivers/staging/lustre/lustre/osc/osc_page.c | 43 ++++++----- drivers/staging/lustre/lustre/osc/osc_request.c | 7 +- drivers/staging/lustre/lustre/ptlrpc/client.c | 67 +++++++++++----- drivers/staging/lustre/lustre/ptlrpc/niobuf.c | 20 ++--- .../staging/lustre/lustre/ptlrpc/pack_generic.c | 26 +++++-- .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 1 + drivers/staging/lustre/lustre/ptlrpc/recover.c | 12 +-- drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/service.c | 14 +++- drivers/staging/lustre/lustre/ptlrpc/wiretest.c | 1 - 48 files changed, 585 insertions(+), 296 deletions(-)
Signature · 1 line
1.8.3.1
PATCH 1/30 lustre: lnd: resolve IP query code in LND drivers
The recent IP querying code that landed to both ksocklnd and ko2iblnd have some bugs that prevent proper setup. The first bug in both drivers is that the IP address of ifa_local is in big endian format so on little endian systems the IP address is incorrect. Calling ntohl() on ifa_local gets the real IP address. The second bug located in ko2iblnd is that in_dev is always NULL. Add the call __in_dev_get_rtnl() to get in_dev and use that information to query the IP address.
--- drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 12 +++++++++--- drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-)
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +9 -3
@@ -2468,8 +2468,7 @@ static struct kib_dev *kiblnd_create_dev(char *ifname) flags =dev_get_flags (netdev);if (!(flags &IFF_UP )) {CERROR ("Can't query IPoIB interface %s: it's down\n" , ifname); -rtnl_unlock (); -return NULL ; + goto unlock; } dev =kzalloc (sizeof (*dev),GFP_NOFS );
@@ -2481,9 +2480,16 @@ static struct kib_dev *kiblnd_create_dev(char *ifname)INIT_LIST_HEAD (&dev->ibd_nets);INIT_LIST_HEAD (&dev->ibd_list);/* not yet in kib_devs */ INIT_LIST_HEAD (&dev->ibd_fail_list); + + in_dev =__in_dev_get_rtnl (netdev); +if (!in_dev) { +kfree (dev); + goto unlock; + } +for_primary_ifa (in_dev) if (strcmp(ifa->ifa_label, ifname) == 0) { - dev->ibd_ifip = ifa->ifa_local; + dev->ibd_ifip =ntohl (ifa->ifa_local);break ; }endfor_ifa (in_dev);
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +1 -1
@@ -2589,7 +2589,7 @@ static int ksocknal_push(struct lnet_ni *ni, struct lnet_process_id id) }for_primary_ifa (in_dev) if (strcmp(ifa->ifa_label, name) == 0) { - ksi->ksni_ipaddr = ifa->ifa_local; + ksi->ksni_ipaddr =ntohl (ifa->ifa_local); ksi->ksni_netmask = ifa->ifa_mask;strlcpy (ksi->ksni_name, name,sizeof (ksi->ksni_name));
Signature · 1 line
1.8.3.1
PATCH 1/30 lustre: lnd: resolve IP query code in LND drivers
Quoted 8 lines · James Simmons
The recent IP querying code that landed to both ksocklnd and ko2iblnd have some bugs that prevent proper setup. The first bug in both drivers is that the IP address of
ifa_localis in big endian format so on little endian systems the IP address is incorrect. Callingntohl()onifa_localgets the real IP address. The second bug located in ko2iblnd is thatin_devis always NULL. Add the call__in_dev_get_rtnl()to getin_devand use that information to query the IP address.
Thanks!
I've added:
and applied this.
NeilBrown
Quoted 54 lines
Signed-off-by James Simmons <[email protected]>--- drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 12 +++++++++--- drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-)drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +9
-3@@ -2468,8 +2468,7 @@ static struct kib_dev *kiblnd_create_dev(char *ifname) flags =dev_get_flags (netdev);if (!(flags &IFF_UP )) {CERROR ("Can't query IPoIB interface %s: it's down\n" , ifname); -rtnl_unlock (); -return NULL ; + goto unlock; } dev =kzalloc (sizeof (*dev),GFP_NOFS );@@ -2481,9 +2480,16 @@ static struct kib_dev *kiblnd_create_dev(char *ifname)INIT_LIST_HEAD (&dev->ibd_nets);INIT_LIST_HEAD (&dev->ibd_list);/* not yet in kib_devs */ INIT_LIST_HEAD (&dev->ibd_fail_list); + + in_dev =__in_dev_get_rtnl (netdev); +if (!in_dev) { +kfree (dev); + goto unlock; + } +for_primary_ifa (in_dev) if (strcmp(ifa->ifa_label, ifname) == 0) { - dev->ibd_ifip = ifa->ifa_local; + dev->ibd_ifip =ntohl (ifa->ifa_local);break ; }endfor_ifa (in_dev);drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +1
-1@@ -2589,7 +2589,7 @@ static int ksocknal_push(struct lnet_ni *ni, struct lnet_process_id id) }for_primary_ifa (in_dev) if (strcmp(ifa->ifa_label, name) == 0) { - ksi->ksni_ipaddr = ifa->ifa_local; + ksi->ksni_ipaddr =ntohl (ifa->ifa_local); ksi->ksni_netmask = ifa->ifa_mask;strlcpy (ksi->ksni_name, name,sizeof (ksi->ksni_name));Signature · 1 line
1.8.3.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180924/08db0d01/attachment.sig>
PATCH 2/30 lustre: uapi: add documentation about FIDs
In reply to James SimmonsFrom: Niu Yawei <[email protected]>
Add details about FIDs in lustre. FIDs are exposed to user land so users can manage them. This provides the users details to assist them.
WC-bug-id: https://jira.whamcloud.com/browse/LU-8998
Reviewed-on: https://review.whamcloud.com/24867
--- .../lustre/include/uapi/linux/lustre/lustre_idl.h | 84 ++++++++++++++++++++++ 1 file changed, 84 insertions(+)
drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h +84 -0
@@ -223,6 +223,90 @@ enum {#define LL_HSM_MAX_ARCHIVE (sizeof(__u32) * 8)/** +* Different FID Format +* http://arch.lustre.org/index.php?title=Interoperability_fids_zfs#NEW.0 +* +* FID: +* File IDentifier generated by client from range allocated by the seq service. +* First 0x400 sequences [2^33, 2^33 + 0x400] are reserved for system use. Note +* that on ldiskfs MDTs that IGIF FIDs can use inode numbers starting at 12, +* but this is in the IGIF SEQ rangeand does not conflict with assigned FIDs. +* +* IGIF: +* Inode and Generation In FID, a surrogate FID used to globally identify an +* existing object on OLD formatted MDT file system. This would only be used on +* MDT0 in a DNE filesystem, because there are not expected to be any OLD +* formatted DNE filesystems. Belongs to a sequence in [12, 2^32 - 1] range, +* where sequence number is inode number, and inode generation is used as OID. +* NOTE: This assumes no more than 2^32-1 inodes exist in the MDT filesystem, +* which is the maximum possible for an ldiskfs backend. NOTE: This assumes +* that the reserved ext3/ext4/ldiskfs inode numbers [0-11] are never visible +* to clients, which has always been true. +* +* IDIF: +* Object ID in FID, a surrogate FID used to globally identify an existing +* object on OLD formatted OST file system. Belongs to a sequence in +* [2^32, 2^33 - 1]. Sequence number is calculated as: +* 1 << 32 | (ost_index << 16) | ((objid >> 32) & 0xffff) +* that is, SEQ consists of 16-bit OST index, and higher 16 bits of object ID. +* The generation of unique SEQ values per OST allows the IDIF FIDs to be +* identified in the FLD correctly. The OID field is calculated as: +* objid & 0xffffffff +* that is, it consists of lower 32 bits of object ID. NOTE This assumes that +* no more than 2^48-1 objects have ever been created on an OST, and that no +* more than 65535 OSTs are in use. Both are very reasonable assumptions (can +* uniquely map all objects on an OST that created 1M objects per second for 9 +* years, or combinations thereof). +* +* OST_MDT0: +* Surrogate FID used to identify an existing object on OLD formatted OST +* filesystem. Belongs to the reserved sequence 0, and is used internally prior +* to the introduction of FID-on-OST, at which point IDIF will be used to +* identify objects as residing on a specific OST. +* +* LLOG: +* For Lustre Log objects the object sequence 1 is used. This is compatible with +* both OLD and NEW.1 namespaces, as this SEQ number is in the ext3/ldiskfs +* reserved inode range and does not conflict with IGIF sequence numbers. +* +* ECHO: +* For testing OST IO performance the object sequence 2 is used. This is +* compatible with both OLD and NEW.1 namespaces, as this SEQ number is in the +* ext3/ldiskfs reserved inode range and does not conflict with IGIF sequence +* numbers. +* +* OST_MDT1 .. OST_MAX: +* For testing with multiple MDTs the object sequence 3 through 9 is used, +* allowing direct mapping of MDTs 1 through 7 respectively, for a total of 8 +* MDTs including OST_MDT0. This matches the legacy CMD project "group" +* mappings. However, this SEQ range is only for testing prior to any production +* DNE release, as the objects in this range conflict across all OSTs, as the +* OST index is not part of the FID. +* +* +* For compatibility with existing OLD OST network protocol structures, the FID +* must map onto the o_id and o_gr in a manner that ensures existing objects are +* identified consistently for IO, as well as onto the lock namespace to ensure +* both IDIFs map onto the same objects for IO as well as resources in the DLM. +* +* DLM OLD OBIF/IDIF: +* resource[] = {o_id, o_seq, 0, 0}; // o_seq == 0 for production releases +* +* DLM NEW.1 FID (this is the same for both the MDT and OST): +* resource[] = {SEQ, OID, VER, HASH}; +* +* Note that for mapping IDIF values to DLM resource names the o_id may be +* larger than the 2^33 reserved sequence numbers for IDIF, so it is possible +* for the o_id numbers to overlap FID SEQ numbers in the resource. However, in +* all production releases the OLD o_seq field is always zero, and all valid FID +* OID values are non-zero, so the lock resources will not collide. +* +* For objects within the IDIF range, group extraction (non-CMD) will be: +* o_id = (fid->f_seq & 0x7fff) << 16 | fid->f_oid; +* o_seq = 0; // formerly group number +*/ + +/** * Note that reserved SEQ numbers below 12 will conflict with ldiskfs * inodes in the IGIF namespace, so these reserved SEQ numbers can be * used for other purposes and not risk collisions with existing inodes.
Signature · 1 line
1.8.3.1
PATCH 3/30 lustre: osc: fix for cl_env_get in low memory
In reply to James SimmonsFrom: Alexander Boyko <[email protected]>
In low memory situation cl_env_get->cl_env_new->kmem_cache_alloc could fail with ENOMEM error. Some parts doesn`t handle error case, for example:
...(osc_lock_upcall()) ASSERTION( !IS_ERR(env) ) failed:
...(osc_lock.c:315:osc_lock_upcall()) LBUG
For osc_lock_upcall() the patch changes cl_env_get to cl_env_percpu_peek, this prevents memory allocation and couldn`t fail in low memory case.
For osc_extent_truncate() the patch adds error handle.
WC-bug-id: https://jira.whamcloud.com/browse/LU-9065
Seagate-bug-id: MRP-4120
Reviewed-on: https://review.whamcloud.com/25171
--- drivers/staging/lustre/lustre/osc/osc_cache.c | 3 +++ drivers/staging/lustre/lustre/osc/osc_lock.c | 5 ++--- 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/staging/lustre/lustre/osc/osc_cache.c +3 -0
@@ -1038,6 +1038,9 @@ static int osc_extent_truncate(struct osc_extent *ext, pgoff_t trunc_index,* it's from lov_io_sub and not fully initialized. */ env =cl_env_get (&refcheck); +if (IS_ERR (env)) +return PTR_ERR (env); + io = &osc_env_info (env)->oti_io; io->ci_obj =cl_object_top (osc2cl (obj)); io->ci_ignore_layout =1 ;
drivers/staging/lustre/lustre/osc/osc_lock.c +2 -3
@@ -297,9 +297,8 @@ 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; -u16 refcheck; - env =cl_env_get (&refcheck); + env =cl_env_percpu_get ();/* should never happen, similar to osc_ldlm_blocking_ast(). */ LASSERT (!IS_ERR (env));
@@ -338,7 +337,7 @@ static int osc_lock_upcall(void *cookie, struct lustre_handle *lockh,if (oscl->ols_owner)cl_sync_io_note (env, oscl->ols_owner, rc); -cl_env_put (env, &refcheck); +cl_env_percpu_put (env);return rc; }
Signature · 1 line
1.8.3.1
PATCH 4/30 lustre: ptlrpc: fix wrong error handlers
In reply to James SimmonsFrom: Alexander Boyko <[email protected]>
If ptlrpc_request_pack finish with 0, we need to call ptlrpc_req_finished for later errors.
WC-bug-id: https://jira.whamcloud.com/browse/LU-9286
Seagate-bug-id: MRP-4285
Reviewed-on: https://review.whamcloud.com/26319
--- drivers/staging/lustre/lustre/mdc/mdc_request.c | 2 +- drivers/staging/lustre/lustre/osc/osc_request.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/mdc/mdc_request.c +1 -1
@@ -904,7 +904,7 @@ static int mdc_getpage(struct obd_export *exp, const struct lu_fid *fid,MDS_BULK_PORTAL , &ptlrpc_bulk_kiov_pin_ops);if (!desc) { -ptlrpc_request_free (req); +ptlrpc_req_finished (req);return -ENOMEM ; }
drivers/staging/lustre/lustre/osc/osc_request.c +1 -1
@@ -655,7 +655,7 @@ static int osc_destroy(const struct lu_env *env, struct obd_export *exp, rc =l_wait_event_abortable_exclusive (cli->cl_destroy_waitq,osc_can_send_destroy (cli));if (rc) { -ptlrpc_request_free (req); +ptlrpc_req_finished (req);return rc; } }
Signature · 1 line
1.8.3.1
PATCH 5/30 lustre: osc: GPF while doing ELC with no_wait_policy
In reply to James SimmonsFrom: Andriy Skulysh <[email protected]>
osc_ldlm_weigh_ast() uses osc_object from ldlm_lock without taking a reference.
It should take a reference like osc_ldlm_glimpse_ast()/ osc_dlm_blocking_ast0() does.
WC-bug-id: https://jira.whamcloud.com/browse/LU-9171
Seagate-bug-id: MRP-4179
Reviewed-on: https://review.whamcloud.com/25700
--- drivers/staging/lustre/lustre/osc/osc_lock.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/staging/lustre/lustre/osc/osc_lock.c +8 -0
@@ -701,7 +701,12 @@ unsigned long osc_ldlm_weigh_ast(struct ldlm_lock *dlmlock)return 1 ;LASSERT (dlmlock->l_resource->lr_type ==LDLM_EXTENT ); +lock_res_and_lock (dlmlock); obj = dlmlock->l_ast_data; +if (obj) +cl_object_get (osc2cl (obj)); +unlock_res_and_lock (dlmlock); +if (!obj) { weight =1 ; goto out;
@@ -725,6 +730,9 @@ unsigned long osc_ldlm_weigh_ast(struct ldlm_lock *dlmlock) weight =osc_lock_weight (env, obj, &dlmlock->l_policy_data.l_extent); out: +if (obj) +cl_object_put (env,osc2cl (obj)); +cl_env_put (env, &refcheck);return weight; }
Signature · 1 line
1.8.3.1
PATCH 6/30 lustre: ptlrpc: Prevent possible dereference of NULL pointers
In reply to James SimmonsFrom: Steve Guminski <[email protected]>
Check pointers for NULL before passing to other functions.
WC-bug-id: https://jira.whamcloud.com/browse/LU-9076
Reviewed-on: https://review.whamcloud.com/25909
--- drivers/staging/lustre/lustre/ptlrpc/client.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/staging/lustre/lustre/ptlrpc/client.c +8 -6
@@ -1978,12 +1978,14 @@ int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set) }ptlrpc_rqphase_move (req,RQ_PHASE_COMPLETE ); -CDEBUG (req->rq_reqmsg ?D_RPCTRACE :0 , -"Completed RPC pname:cluuid:pid:xid:nid:opc %s:%s:%d:%llu:%s:%d\n" , - current->comm, imp->imp_obd->obd_uuid.uuid, -lustre_msg_get_status (req->rq_reqmsg), req->rq_xid, -libcfs_nid2str (imp->imp_connection->c_peer.nid), -lustre_msg_get_opc (req->rq_reqmsg)); +if (req->rq_reqmsg) +CDEBUG (D_RPCTRACE , +"Completed RPC pname:cluuid:pid:xid:nid:opc %s:%s:%d:%llu:%s:%d\n" , + current->comm, imp->imp_obd->obd_uuid.uuid, +lustre_msg_get_status (req->rq_reqmsg), + req->rq_xid, +libcfs_nid2str (imp->imp_connection->c_peer.nid), +lustre_msg_get_opc (req->rq_reqmsg));spin_lock (&imp->imp_lock);/*
Signature · 1 line
1.8.3.1
PATCH 7/30 lustre: llog: update llog print format to use FIDs
In reply to James SimmonsFrom: Andreas Dilger <[email protected]>
Print llog identifiers using FIDs instead of OSTID format, which has been deprecated since 2.3.
WC-bug-id: https://jira.whamcloud.com/browse/LU-9153
Reviewed-on: https://review.whamcloud.com/25640
--- drivers/staging/lustre/lustre/obdclass/llog_cat.c | 28 ++++++++++++---------- drivers/staging/lustre/lustre/obdclass/llog_swab.c | 4 ++-- 2 files changed, 17 insertions(+), 15 deletions(-)
drivers/staging/lustre/lustre/obdclass/llog_cat.c +15 -13
@@ -79,10 +79,10 @@ static int llog_cat_id2handle(const struct lu_env *env,if (ostid_id (&cgl->lgl_oi) ==ostid_id (&logid->lgl_oi) &&ostid_seq (&cgl->lgl_oi) ==ostid_seq (&logid->lgl_oi)) {if (cgl->lgl_ogen != logid->lgl_ogen) { -CERROR ("%s: log " DOSTID " generation %x != %x\n" , - loghandle->lgh_ctxt->loc_obd->obd_name, -POSTID (&logid->lgl_oi), cgl->lgl_ogen, - logid->lgl_ogen); +CWARN ("%s: log " DFID " generation %x != %x\n" , + loghandle->lgh_ctxt->loc_obd->obd_name, +PFID (&logid->lgl_oi.oi_fid), + cgl->lgl_ogen, logid->lgl_ogen);continue ; } loghandle->u.phd.phd_cat_handle = cathandle;
@@ -96,9 +96,9 @@ static int llog_cat_id2handle(const struct lu_env *env, rc =llog_open (env, cathandle->lgh_ctxt, &loghandle, logid,NULL ,LLOG_OPEN_EXISTS );if (rc <0 ) { -CERROR ("%s: error opening log id " DOSTID ":%x: rc = %d\n" , +CERROR ("%s: error opening log id " DFID ":%x: rc = %d\n" , cathandle->lgh_ctxt->loc_obd->obd_name, -POSTID (&logid->lgl_oi), logid->lgl_ogen, rc); +PFID (&logid->lgl_oi.oi_fid), logid->lgl_ogen, rc);return rc; }
@@ -153,15 +153,16 @@ static int llog_cat_process_cb(const struct lu_env *env,CERROR ("invalid record in catalog\n" );return -EINVAL ; } -CDEBUG (D_HA ,"processing log " DOSTID ":%x at index %u of catalog " -DOSTID "\n" ,POSTID (&lir->lid_id.lgl_oi), lir->lid_id.lgl_ogen, - rec->lrh_index,POSTID (&cat_llh->lgh_id.lgl_oi)); +CDEBUG (D_HA , +"processing log " DFID ":%x at index %u of catalog " DFID "\n" , +PFID (&lir->lid_id.lgl_oi.oi_fid), lir->lid_id.lgl_ogen, + rec->lrh_index,PFID (&cat_llh->lgh_id.lgl_oi.oi_fid)); rc =llog_cat_id2handle (env, cat_llh, &llh, &lir->lid_id);if (rc) { -CERROR ("%s: cannot find handle for llog " DOSTID ": %d\n" , +CERROR ("%s: cannot find handle for llog " DFID ": %d\n" , cat_llh->lgh_ctxt->loc_obd->obd_name, -POSTID (&lir->lid_id.lgl_oi), rc); +PFID (&lir->lid_id.lgl_oi.oi_fid), rc);return rc; }
@@ -206,8 +207,9 @@ static int llog_cat_process_or_fork(const struct lu_env *env,if (llh->llh_cat_idx > cat_llh->lgh_last_idx) {struct llog_process_cat_data cd; -CWARN ("catlog " DOSTID " crosses index zero\n" , -POSTID (&cat_llh->lgh_id.lgl_oi)); +CWARN ("%s: catlog " DFID " crosses index zero\n" , + cat_llh->lgh_ctxt->loc_obd->obd_name, +PFID (&cat_llh->lgh_id.lgl_oi.oi_fid)); cd.lpcd_first_idx = llh->llh_cat_idx; cd.lpcd_last_idx =0 ;
drivers/staging/lustre/lustre/obdclass/llog_swab.c +2 -2
@@ -45,8 +45,8 @@static void print_llogd_body (struct llogd_body *d) {CDEBUG (D_OTHER ,"llogd body: %p\n" , d); -CDEBUG (D_OTHER ,"\tlgd_logid.lgl_oi: " DOSTID "\n" , -POSTID (&d->lgd_logid.lgl_oi)); +CDEBUG (D_OTHER ,"\tlgd_logid.lgl_oi: " DFID "\n" , +PFID (&d->lgd_logid.lgl_oi.oi_fid));CDEBUG (D_OTHER ,"\tlgd_logid.lgl_ogen: %#x\n" , d->lgd_logid.lgl_ogen);CDEBUG (D_OTHER ,"\tlgd_ctxt_idx: %#x\n" , d->lgd_ctxt_idx);CDEBUG (D_OTHER ,"\tlgd_llh_flags: %#x\n" , d->lgd_llh_flags);
Signature · 1 line
1.8.3.1
PATCH 8/30 lustre: mgc: Remove unnecessary checks for config_log_put()
In reply to James SimmonsFrom: Steve Guminski <[email protected]>
Make config_log_put() check if its parameter is NULL, which makes it is unnecessary to perform the check prior to calling it. This patch removes the redundant checks.
WC-bug-id: https://jira.whamcloud.com/browse/LU-9152
Reviewed-on: https://review.whamcloud.com/25854
--- drivers/staging/lustre/lustre/mgc/mgc_request.c | 36 +++++++++++-------------- 1 file changed, 16 insertions(+), 20 deletions(-)
drivers/staging/lustre/lustre/mgc/mgc_request.c +16 -20
@@ -131,6 +131,9 @@ static int config_log_get(struct config_llog_data *cld)*/ static void config_log_put (struct config_llog_data *cld) { +if (unlikely (!cld)) +return ; +CDEBUG (D_INFO ,"log %s refs %d\n" , cld->cld_logname,atomic_read (&cld->cld_refcount));LASSERT (atomic_read (&cld->cld_refcount) >0 );
@@ -142,12 +145,9 @@ static void config_log_put(struct config_llog_data *cld)CDEBUG (D_MGC ,"dropping config log %s\n" , cld->cld_logname); -if (cld->cld_recover) -config_log_put (cld->cld_recover); -if (cld->cld_params) -config_log_put (cld->cld_params); -if (cld->cld_sptlrpc) -config_log_put (cld->cld_sptlrpc); +config_log_put (cld->cld_recover); +config_log_put (cld->cld_params); +config_log_put (cld->cld_sptlrpc);if (cld_is_sptlrpc (cld))sptlrpc_conf_log_stop (cld->cld_logname);
@@ -387,6 +387,9 @@ struct config_llog_data *do_config_log_add(struct obd_device *obd,static inline void config_mark_cld_stop (struct config_llog_data *cld) { +if (!cld) +return ; +mutex_lock (&cld->cld_lock);spin_lock (&config_list_lock); cld->cld_stopping =1 ;
@@ -436,18 +439,13 @@ static int config_log_end(char *logname, struct config_llog_instance *cfg) cld->cld_sptlrpc =NULL ;mutex_unlock (&cld->cld_lock); -if (cld_recover) { -config_mark_cld_stop (cld_recover); -config_log_put (cld_recover); - } +config_mark_cld_stop (cld_recover); +config_log_put (cld_recover); -if (cld_params) { -config_mark_cld_stop (cld_params); -config_log_put (cld_params); - } +config_mark_cld_stop (cld_params); +config_log_put (cld_params); -if (cld_sptlrpc) -config_log_put (cld_sptlrpc); +config_log_put (cld_sptlrpc);/* drop the ref from the find */ config_log_put (cld);
@@ -593,8 +591,7 @@ static int mgc_requeue_thread(void *data) cld->cld_lostlock =0 ;spin_unlock (&config_list_lock); -if (cld_prev) -config_log_put (cld_prev); +config_log_put (cld_prev); cld_prev = cld;if (likely (!(rq_state &RQ_STOP ))) {
@@ -606,8 +603,7 @@ static int mgc_requeue_thread(void *data) } }spin_unlock (&config_list_lock); -if (cld_prev) -config_log_put (cld_prev); +config_log_put (cld_prev);/* Wait a bit to see if anyone else needs a requeue */ wait_event_idle (rq_waitq, rq_state & (RQ_NOW |RQ_STOP ));
Signature · 1 line
1.8.3.1
PATCH 8/30 lustre: mgc: Remove unnecessary checks for config_log_put()
Quoted 22 lines · James Simmons
From: Steve Guminski <[email protected]>
Make
config_log_put()check if its parameter is NULL, which makes it is unnecessary to perform the check prior to calling it. This patch removes the redundant checks.Signed-off-by Steve Guminski <[email protected]>WC-bug-id: https://jira.whamcloud.com/browse/LU-9152
Reviewed-on: https://review.whamcloud.com/25854Reviewed-by Bob Glossman <[email protected]>Reviewed-by Andreas Dilger <[email protected]>Reviewed-by James Simmons <[email protected]>Signed-off-by James Simmons <[email protected]>--- drivers/staging/lustre/lustre/mgc/mgc_request.c | 36 +++++++++++-------------- 1 file changed, 16 insertions(+), 20 deletions(-)drivers/staging/lustre/lustre/mgc/mgc_request.c +0
-0
drivers/staging/lustre/lustre/mgc/mgc_request.c static int config_log_get(struct config_llog_data *cld) · line 136
Quoted 6 lines
drivers/staging/lustre/lustre/mgc/mgc_request.c +3
-0@@ -131,6 +131,9 @@ static int config_log_get(struct config_llog_data *cld)*/ static void config_log_put (struct config_llog_data *cld) { +if (unlikely (!cld)) +return ; +
I've removed the "unlikely()" call.
Partly because use of likely/unlikely is discouraged where the difference cannot be measured (or clearly justified some other way), and partly because .....
drivers/staging/lustre/lustre/mgc/mgc_request.c struct config_llog_data *do_config_log_add(struct obd_device *obd, · line 392
Quoted 7 lines
drivers/staging/lustre/lustre/mgc/mgc_request.c +3
-0@@ -387,6 +387,9 @@ struct config_llog_data *do_config_log_add(struct obd_device *obd,static inline void config_mark_cld_stop (struct config_llog_data *cld) { +if (!cld) +return ; +
.... there is no "unlikely()" here, and I like consistency.
Thanks,
NeilBrown
Quoted 49 lines
drivers/staging/lustre/lustre/mgc/mgc_request.c +7
-14mutex_lock (&cld->cld_lock);spin_lock (&config_list_lock); cld->cld_stopping =1 ;@@ -436,18 +439,13 @@ static int config_log_end(char *logname, struct config_llog_instance *cfg) cld->cld_sptlrpc =NULL ;mutex_unlock (&cld->cld_lock); -if (cld_recover) { -config_mark_cld_stop (cld_recover); -config_log_put (cld_recover); - } +config_mark_cld_stop (cld_recover); +config_log_put (cld_recover); -if (cld_params) { -config_mark_cld_stop (cld_params); -config_log_put (cld_params); - } +config_mark_cld_stop (cld_params); +config_log_put (cld_params); -if (cld_sptlrpc) -config_log_put (cld_sptlrpc); +config_log_put (cld_sptlrpc);/* drop the ref from the find */ config_log_put (cld);@@ -593,8 +591,7 @@ static int mgc_requeue_thread(void *data) cld->cld_lostlock =0 ;spin_unlock (&config_list_lock); -if (cld_prev) -config_log_put (cld_prev); +config_log_put (cld_prev); cld_prev = cld;if (likely (!(rq_state &RQ_STOP ))) {@@ -606,8 +603,7 @@ static int mgc_requeue_thread(void *data) } }spin_unlock (&config_list_lock); -if (cld_prev) -config_log_put (cld_prev); +config_log_put (cld_prev);/* Wait a bit to see if anyone else needs a requeue */ wait_event_idle (rq_waitq, rq_state & (RQ_NOW |RQ_STOP ));Signature · 1 line
1.8.3.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180924/14be13eb/attachment.sig>
PATCH 8/30 lustre: mgc: Remove unnecessary checks for config_log_put()
Quoted 32 lines
Quoted 23 lines
From: Steve Guminski <[email protected]>
Make
config_log_put()check if its parameter is NULL, which makes it is unnecessary to perform the check prior to calling it. This patch removes the redundant checks.Signed-off-by Steve Guminski <[email protected]>WC-bug-id: https://jira.whamcloud.com/browse/LU-9152
Reviewed-on: https://review.whamcloud.com/25854Reviewed-by Bob Glossman <[email protected]>Reviewed-by Andreas Dilger <[email protected]>Reviewed-by James Simmons <[email protected]>Signed-off-by James Simmons <[email protected]>--- drivers/staging/lustre/lustre/mgc/mgc_request.c | 36 +++++++++++-------------- 1 file changed, 16 insertions(+), 20 deletions(-)drivers/staging/lustre/lustre/mgc/mgc_request.c +0
-0drivers/staging/lustre/lustre/mgc/mgc_request.c static int config_log_get(struct config_llog_data *cld) · line 136
Quoted 6 lines
drivers/staging/lustre/lustre/mgc/mgc_request.c +3
-0@@ -131,6 +131,9 @@ static int config_log_get(struct config_llog_data *cld)*/ static void config_log_put (struct config_llog_data *cld) { +if (unlikely (!cld)) +return ; +I've removed the "
unlikely()" call.
Quoted 3 lines
Partly because use of likely/unlikely is discouraged where the difference cannot be measured (or clearly justified some other way), and partly because .....
I kept it in since it was in the original patch. Personally I'm not a fan either. The only time I would use it is in a case where code is executed 100k+ times a second and even then I question if you really get any boost with modern processors.
Quoted 64 lines
drivers/staging/lustre/lustre/mgc/mgc_request.c struct config_llog_data *do_config_log_add(struct obd_device *obd, · line 392
Quoted 7 lines
drivers/staging/lustre/lustre/mgc/mgc_request.c +3
-0@@ -387,6 +387,9 @@ struct config_llog_data *do_config_log_add(struct obd_device *obd,static inline void config_mark_cld_stop (struct config_llog_data *cld) { +if (!cld) +return ; +.... there is no "
unlikely()" here, and I like consistency.Thanks,
NeilBrownQuoted 49 lines
drivers/staging/lustre/lustre/mgc/mgc_request.c +7
-14mutex_lock (&cld->cld_lock);spin_lock (&config_list_lock); cld->cld_stopping =1 ;@@ -436,18 +439,13 @@ static int config_log_end(char *logname, struct config_llog_instance *cfg) cld->cld_sptlrpc =NULL ;mutex_unlock (&cld->cld_lock); -if (cld_recover) { -config_mark_cld_stop (cld_recover); -config_log_put (cld_recover); - } +config_mark_cld_stop (cld_recover); +config_log_put (cld_recover); -if (cld_params) { -config_mark_cld_stop (cld_params); -config_log_put (cld_params); - } +config_mark_cld_stop (cld_params); +config_log_put (cld_params); -if (cld_sptlrpc) -config_log_put (cld_sptlrpc); +config_log_put (cld_sptlrpc);/* drop the ref from the find */ config_log_put (cld);@@ -593,8 +591,7 @@ static int mgc_requeue_thread(void *data) cld->cld_lostlock =0 ;spin_unlock (&config_list_lock); -if (cld_prev) -config_log_put (cld_prev); +config_log_put (cld_prev); cld_prev = cld;if (likely (!(rq_state &RQ_STOP ))) {@@ -606,8 +603,7 @@ static int mgc_requeue_thread(void *data) } }spin_unlock (&config_list_lock); -if (cld_prev) -config_log_put (cld_prev); +config_log_put (cld_prev);/* Wait a bit to see if anyone else needs a requeue */ wait_event_idle (rq_waitq, rq_state & (RQ_NOW |RQ_STOP ));Signature · 1 line
1.8.3.1
PATCH 9/30 lustre: obd: remove obsolete OBD_FL_LOCAL_MASK
In reply to James SimmonsFrom: Wang Shilong <[email protected]>
Andreas Dilger reported that the OBD_FL_LOCAL_MASK support has not been used since commit e62f0a3c5b9 b=21980 cache ll_obdo_cache:
Can't free all objects; which predates the linux client. With the future landing of patch https://review.whamcloud.com/26463
lustre: quota: add project inherit attributes the handling of the "local" flags is broken and since it is unused it is better to be removed entirely.
WC-bug-id: https://jira.whamcloud.com/browse/LU-9355
Reviewed-on: https://review.whamcloud.com/26728
--- drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h | 4 +--- drivers/staging/lustre/lustre/obdclass/obdo.c | 11 ----------- drivers/staging/lustre/lustre/osc/osc_request.c | 5 ++--- drivers/staging/lustre/lustre/ptlrpc/wiretest.c | 1 - 4 files changed, 3 insertions(+), 18 deletions(-)
drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h +1 -3
@@ -931,15 +931,13 @@ enum obdo_flags {OBD_FL_NOSPC_BLK =0x00100000 ,/* no more block space on OST */ OBD_FL_FLUSH =0x00200000 ,/* flush pages on the OST */ OBD_FL_SHORT_IO =0x00400000 ,/* short io request */ +/* OBD_FL_LOCAL_MASK = 0xF0000000, was local-only flags until 2.10 */ /* Note that while these checksum values are currently separate bits, * in 2.x we can actually allow all values from 1-31 if we wanted. */ OBD_FL_CKSUM_ALL =OBD_FL_CKSUM_CRC32 |OBD_FL_CKSUM_ADLER | OBD_FL_CKSUM_CRC32C, - -/* mask for local-only flag, which won't be sent over network */ - OBD_FL_LOCAL_MASK = 0xF0000000, };/*
drivers/staging/lustre/lustre/obdclass/obdo.c +0 -11
@@ -134,7 +134,6 @@ void lustre_set_wire_obdo(const struct obd_connect_data *ocd, struct obdo *wobdo, const struct obdo *lobdo) { *wobdo = *lobdo; - wobdo->o_flags &= ~OBD_FL_LOCAL_MASK ;if (!ocd)return ;
@@ -156,17 +155,7 @@ void lustre_set_wire_obdo(const struct obd_connect_data *ocd,void lustre_get_wire_obdo (const struct obd_connect_data *ocd,struct obdo *lobdo,const struct obdo *wobdo) { -u32 local_flags =0 ; - -if (lobdo->o_valid &OBD_MD_FLFLAGS ) - local_flags = lobdo->o_flags &OBD_FL_LOCAL_MASK ; - *lobdo = *wobdo; -if (local_flags) { - lobdo->o_valid |=OBD_MD_FLFLAGS ; - lobdo->o_flags &= ~OBD_FL_LOCAL_MASK ; - lobdo->o_flags |= local_flags; - }if (!ocd)return ;
drivers/staging/lustre/lustre/osc/osc_request.c +2 -3
@@ -1273,10 +1273,9 @@ static int osc_brw_prep_request(int cmd, struct client_obd *cli,*/ enum cksum_type cksum_type = cli->cl_cksum_type; -if ((body->oa.o_valid &OBD_MD_FLFLAGS ) ==0 ) { - oa->o_flags &=OBD_FL_LOCAL_MASK ; +if ((body->oa.o_valid &OBD_MD_FLFLAGS ) ==0 ) body->oa.o_flags =0 ; - } + body->oa.o_flags |=cksum_type_pack (cksum_type); body->oa.o_valid |=OBD_MD_FLCKSUM |OBD_MD_FLFLAGS ; body->oa.o_cksum = osc_checksum_bulk(requested_nob,
drivers/staging/lustre/lustre/ptlrpc/wiretest.c +0 -1
@@ -1344,7 +1344,6 @@ void lustre_assert_wire_constants(void)BUILD_BUG_ON (OBD_FL_MMAP !=0x00040000 );BUILD_BUG_ON (OBD_FL_RECOV_RESEND !=0x00080000 );BUILD_BUG_ON (OBD_FL_NOSPC_BLK !=0x00100000 ); -BUILD_BUG_ON (OBD_FL_LOCAL_MASK !=0xf0000000 );/* Checks for struct lov_ost_data_v1 */ LASSERTF((int)sizeof(struct lov_ost_data_v1) == 24, "found %lld\n",
Signature · 1 line
1.8.3.1
PATCH 10/30 lustre: ptlrpc: set rq_sent when send fails due to -ENOMEM
In reply to James SimmonsFrom: "John L. Hammond" <[email protected]>
In ptl_send_rpc() set rq_sent when we fail to send the RPC due to insufficient memory, since this is what the upper layers expect.
WC-bug-id: https://jira.whamcloud.com/browse/LU-9296
Reviewed-on: https://review.whamcloud.com/26470
--- drivers/staging/lustre/lustre/ptlrpc/niobuf.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
drivers/staging/lustre/lustre/ptlrpc/niobuf.c +11 -9
@@ -571,15 +571,8 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) mpflag =memalloc_noreclaim_save (); rc =sptlrpc_cli_wrap_request (request); -if (rc) { -/* -* set rq_sent so that this request is treated -* as a delayed send in the upper layers -*/ -if (rc == -ENOMEM ) - request->rq_sent =ktime_get_seconds (); +if (rc) goto out; - }/* bulk register should be done after wrap_request() */ if (request->rq_bulk) {
@@ -724,9 +717,18 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply)* the chance to have long unlink to sluggish net is smaller here. */ ptlrpc_unregister_bulk (request,0 ); - out: +out: +if (rc == -ENOMEM ) { +/* +* set rq_sent so that this request is treated +* as a delayed send in the upper layers +*/ + request->rq_sent =ktime_get_seconds (); + } +if (request->rq_memalloc)memalloc_noreclaim_restore (mpflag); +return rc; }EXPORT_SYMBOL (ptl_send_rpc);
Signature · 1 line
1.8.3.1
PATCH 11/30 lustre: mdc: allow setting readdir RPC size parameter
In reply to James SimmonsFrom: Andreas Dilger <[email protected]>
Allow the mdc.*.max_pages_per_rpc tunable to set the MDS bulk readdir RPC size, rather than always using the default 1MB RPC size. The tunable is set in the MDC, as it should be, rather than in the llite superblock, which requires extra code just to get it up from the MDC's connect_data only to send it back down. The RPC size could be tuned independently if different types of MDSes are used (e.g. local vs. remote).
Remove the md_op_data.op_max_pages and ll_sb_info.ll_md_brw_pages fields that previously were used to pass the readdir size from llite to mdc_read_page(). Reorder some 32-bit fields in md_op_data to avoid struct holes.
Move osc's max_pages_per_rpc_store() to obdclass along with max_pages_per_rpc_show().
WC-bug-id: https://jira.whamcloud.com/browse/LU-3308
Reviewed-on: https://review.whamcloud.com/26088
--- .../staging/lustre/lustre/include/lprocfs_status.h | 5 ++ drivers/staging/lustre/lustre/include/lustre_net.h | 8 ++-- drivers/staging/lustre/lustre/include/obd.h | 5 +- drivers/staging/lustre/lustre/llite/dir.c | 12 +---- drivers/staging/lustre/lustre/llite/lcommon_cl.c | 19 +++----- .../staging/lustre/lustre/llite/llite_internal.h | 2 - drivers/staging/lustre/lustre/llite/llite_lib.c | 5 -- drivers/staging/lustre/lustre/llite/llite_nfs.c | 1 - drivers/staging/lustre/lustre/llite/statahead.c | 4 -- drivers/staging/lustre/lustre/mdc/lproc_mdc.c | 20 +------- drivers/staging/lustre/lustre/mdc/mdc_request.c | 13 +++--- .../lustre/lustre/obdclass/lprocfs_status.c | 54 ++++++++++++++++++++++ drivers/staging/lustre/lustre/osc/lproc_osc.c | 46 ------------------ drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c | 2 +- 14 files changed, 82 insertions(+), 114 deletions(-)
drivers/staging/lustre/lustre/include/lprocfs_status.h +5 -0
@@ -584,6 +584,11 @@ ssize_t lustre_attr_store(struct kobject *kobj, struct attribute *attr,extern const struct sysfs_ops lustre_sysfs_ops; +ssize_t max_pages_per_rpc_show (struct kobject *kobj,struct attribute *attr, +char *buf); +ssize_t max_pages_per_rpc_store (struct kobject *kobj,struct attribute *attr, +const char *buffer,size_t count); +struct root_squash_info ;int lprocfs_wr_root_squash (const char __user *buffer,unsigned long count,struct root_squash_info *squash,char *name);
drivers/staging/lustre/lustre/include/lustre_net.h +4 -4
@@ -104,15 +104,15 @@* currently supported maximum between peers at connect via ocd_brw_size. */ #define PTLRPC_MAX_BRW_BITS (LNET_MTU_BITS + PTLRPC_BULK_OPS_BITS) -#define PTLRPC_MAX_BRW_SIZE (1 << PTLRPC_MAX_BRW_BITS) +#define PTLRPC_MAX_BRW_SIZE BIT(PTLRPC_MAX_BRW_BITS)#define PTLRPC_MAX_BRW_PAGES (PTLRPC_MAX_BRW_SIZE >> PAGE_SHIFT) -#define ONE_MB_BRW_SIZE (1 << LNET_MTU_BITS) -#define MD_MAX_BRW_SIZE (1 << LNET_MTU_BITS) +#define ONE_MB_BRW_SIZE BIT(LNET_MTU_BITS) +#define MD_MAX_BRW_SIZE BIT(LNET_MTU_BITS)#define MD_MAX_BRW_PAGES (MD_MAX_BRW_SIZE >> PAGE_SHIFT)#define DT_MAX_BRW_SIZE PTLRPC_MAX_BRW_SIZE#define DT_MAX_BRW_PAGES (DT_MAX_BRW_SIZE >> PAGE_SHIFT) -#define OFD_MAX_BRW_SIZE (1 << LNET_MTU_BITS) +#define OFD_MAX_BRW_SIZE BIT(LNET_MTU_BITS)/* When PAGE_SIZE is a constant, we can check our arithmetic here with cpp! */ # if ((PTLRPC_MAX_BRW_PAGES & (PTLRPC_MAX_BRW_PAGES -1 )) !=0 )
drivers/staging/lustre/lustre/include/obd.h +1 -4
@@ -717,11 +717,11 @@ struct md_op_data {struct lu_fid op_fid3;/* 2 extra fids to find conflicting */ struct lu_fid op_fid4;/* to the operation locks. */ u32 op_mds;/* what mds server open will go to */ +u32 op_mode;struct lustre_handle op_handle;s64 op_mod_time;const char *op_name;size_t op_namelen; -__u32 op_mode;struct lmv_stripe_md *op_mea1;struct lmv_stripe_md *op_mea2;__u32 op_suppgids[2 ];
@@ -746,9 +746,6 @@ struct md_op_data {/* Used by readdir */ __u64 op_offset; -/* Used by readdir */ -__u32 op_max_pages; -/* used to transfer info between the stacks of MD client * see enum op_cli_flags */
drivers/staging/lustre/lustre/llite/dir.c +2 -10
@@ -231,18 +231,11 @@ int ll_dir_read(struct inode *inode, __u64 *ppos, struct md_op_data *op_data,__u64 ino; hash =le64_to_cpu (ent->lde_hash); -if (hash < pos) -/* -* Skip until we find target hash -* value. -*/ +if (hash < pos)/* Skip until we find target hash */ continue ; namelen =le16_to_cpu (ent->lde_namelen); -if (namelen ==0 ) -/* -* Skip dummy record. -*/ +if (namelen ==0 )/* Skip dummy record. */ continue ;if (is_api32 && is_hash64)
@@ -351,7 +344,6 @@ static int ll_readdir(struct file *filp, struct dir_context *ctx) } } } - op_data->op_max_pages = sbi->ll_md_brw_pages; ctx->pos = pos; rc =ll_dir_read (inode, &pos, op_data, ctx); pos = ctx->pos;
drivers/staging/lustre/lustre/llite/lcommon_cl.c +7 -12
@@ -267,27 +267,22 @@ void cl_inode_fini(struct inode *inode)/** * build inode number from passed @fid */ -__u64 cl_fid_build_ino (const struct lu_fid *fid,int api32) +u64 cl_fid_build_ino (const struct lu_fid *fid,int api32) {if (BITS_PER_LONG ==32 || api32)return fid_flatten32 (fid); -else -return fid_flatten (fid); + +return fid_flatten (fid); }/** * build inode generation from passed @fid. If our FID overflows the 32-bit * inode number then return a non-zero generation to distinguish them. */ -__u32 cl_fid_build_gen (const struct lu_fid *fid) +u32 cl_fid_build_gen (const struct lu_fid *fid) { -__u32 gen; - -if (fid_is_igif (fid)) { - gen =lu_igif_gen (fid); -return gen; - } +if (fid_is_igif (fid)) +return lu_igif_gen (fid); - gen =fid_flatten (fid) >>32 ; -return gen; +return fid_flatten (fid) >>32 ; }
drivers/staging/lustre/lustre/llite/llite_internal.h +0 -2
@@ -490,8 +490,6 @@ struct ll_sb_info {unsigned int ll_namelen;const struct file_operations *ll_fop; -unsigned int ll_md_brw_pages;/* readdir pages per RPC */ -struct lu_site *ll_site;struct cl_device *ll_cl;/* Statistics */
drivers/staging/lustre/lustre/llite/llite_lib.c +0 -5
@@ -343,11 +343,6 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt)if (data->ocd_connect_flags &OBD_CONNECT_64BITHASH ) sbi->ll_flags |=LL_SBI_64BIT_HASH ; -if (data->ocd_connect_flags &OBD_CONNECT_BRW_SIZE ) - sbi->ll_md_brw_pages = data->ocd_brw_size >>PAGE_SHIFT ; -else - sbi->ll_md_brw_pages =1 ; -if (data->ocd_connect_flags &OBD_CONNECT_LAYOUTLOCK ) sbi->ll_flags |=LL_SBI_LAYOUT_LOCK ;
drivers/staging/lustre/lustre/llite/llite_nfs.c +0 -1
@@ -261,7 +261,6 @@ static int ll_get_name(struct dentry *dentry, char *name, goto out; } - op_data->op_max_pages =ll_i2sbi (dir)->ll_md_brw_pages;inode_lock (dir); rc =ll_dir_read (dir, &pos, op_data, &lgd.ctx);inode_unlock (dir);
drivers/staging/lustre/lustre/llite/statahead.c +0 -4
@@ -961,8 +961,6 @@ static int ll_statahead_thread(void *arg) goto out; } - op_data->op_max_pages =ll_i2sbi (dir)->ll_md_brw_pages; -while (pos !=MDS_DIR_END_OFF && sai->sai_task) {struct lu_dirpage *dp;struct lu_dirent *ent;
@@ -1215,8 +1213,6 @@ static int is_first_dirent(struct inode *dir, struct dentry *dentry)/** * FIXME choose the start offset of the readdir */ - op_data->op_max_pages =ll_i2sbi (dir)->ll_md_brw_pages; - page =ll_get_dir_page (dir, op_data, pos);while (1 ) {
drivers/staging/lustre/lustre/mdc/lproc_mdc.c +2 -18
@@ -134,6 +134,8 @@ static ssize_t max_mod_rpcs_in_flight_store(struct kobject *kobj, }LUSTRE_RW_ATTR (max_mod_rpcs_in_flight); +LUSTRE_RW_ATTR (max_pages_per_rpc); +#define mdc_conn_uuid_show conn_uuid_showLUSTRE_RO_ATTR (mdc_conn_uuid);
@@ -165,24 +167,6 @@ static ssize_t mdc_rpc_stats_seq_write(struct file *file,LPROC_SEQ_FOPS_RO_TYPE (mdc, timeouts);LPROC_SEQ_FOPS_RO_TYPE (mdc, state); -/* -* Note: below sysfs entry is provided, but not currently in use, instead -* sbi->sb_md_brw_size is used, the per obd variable should be used -* when DNE is enabled, and dir pages are managed in MDC layer. -* Don't forget to enable sysfs store function then. -*/ -static ssize_t max_pages_per_rpc_show (struct kobject *kobj, -struct attribute *attr, -char *buf) -{ - struct obd_device *dev = container_of(kobj, struct obd_device, - obd_kset.kobj); -struct client_obd *cli = &dev->u.cli; - -return sprintf (buf,"%d\n" , cli->cl_max_pages_per_rpc); -} -LUSTRE_RO_ATTR (max_pages_per_rpc); -LPROC_SEQ_FOPS_RW_TYPE (mdc, import);LPROC_SEQ_FOPS_RW_TYPE (mdc, pinger_recov);
drivers/staging/lustre/lustre/mdc/mdc_request.c +6 -7
@@ -1166,17 +1166,17 @@ static int mdc_read_page_remote(void *data, struct page *page0)struct page **page_pool;struct page *page;struct lu_dirpage *dp; -int rd_pgs =0 ;/* number of pages read actually */ -int npages;struct md_op_data *op_data = rp->rp_mod;struct ptlrpc_request *req; -int max_pages = op_data->op_max_pages;struct inode *inode;struct lu_fid *fid; -int i; +int rd_pgs =0 ;/* number of pages read actually */ +int max_pages; +int npages;int rc; +int i; -LASSERT (max_pages >0 && max_pages <=PTLRPC_MAX_BRW_PAGES ); + max_pages = rp->rp_exp->exp_obd->u.cli.cl_max_pages_per_rpc; inode = op_data->op_data; fid = &op_data->op_fid1;LASSERT (inode);
@@ -1200,8 +1200,7 @@ static int mdc_read_page_remote(void *data, struct page *page0)if (!rc) {int lu_pgs = req->rq_bulk->bd_nob_transferred; - rd_pgs = (req->rq_bulk->bd_nob_transferred + -PAGE_SIZE -1 ) >>PAGE_SHIFT ; + rd_pgs = (lu_pgs +PAGE_SIZE -1 ) >>PAGE_SHIFT ; lu_pgs >>=LU_PAGE_SHIFT ;LASSERT (!(req->rq_bulk->bd_nob_transferred & ~LU_PAGE_MASK ));
drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +54 -0
57 lines not on this page · raw message
drivers/staging/lustre/lustre/osc/lproc_osc.c +0 -46
52 lines not on this page · raw message
drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c +1 -1
@@ -232,7 +232,7 @@ static unsigned long enc_pools_shrink_count(struct shrinker *s, }LASSERT (page_pools.epp_idle_idx <=IDLE_IDX_MAX ); -return max ((int )page_pools.epp_free_pages -PTLRPC_MAX_BRW_PAGES ,0 ) * +return max (page_pools.epp_free_pages -PTLRPC_MAX_BRW_PAGES ,0UL ) * (IDLE_IDX_MAX - page_pools.epp_idle_idx) /IDLE_IDX_MAX ; }
Signature · 1 line
1.8.3.1
PATCH 11/30 lustre: mdc: allow setting readdir RPC size parameter
Quoted 69 lines · James Simmons
From: Andreas Dilger <[email protected]>
Allow the mdc.*.max_pages_per_rpc tunable to set the MDS bulk readdir RPC size, rather than always using the default 1MB RPC size. The tunable is set in the MDC, as it should be, rather than in the llite superblock, which requires extra code just to get it up from the MDC's
connect_dataonly to send it back down. The RPC size could be tuned independently if different types of MDSes are used (e.g. local vs. remote).Remove the md_op_data.op_max_pages and ll_sb_info.ll_md_brw_pages fields that previously were used to pass the readdir size from llite to
mdc_read_page(). Reorder some 32-bit fields inmd_op_datato avoid struct holes.Move osc's
max_pages_per_rpc_store()to obdclass along withmax_pages_per_rpc_show().Signed-off-by Andreas Dilger <[email protected]>WC-bug-id: https://jira.whamcloud.com/browse/LU-3308
Reviewed-on: https://review.whamcloud.com/26088Reviewed-by Niu Yawei <[email protected]>Reviewed-by Lai Siyao <[email protected]>Reviewed-by Oleg Drokin <[email protected]>Signed-off-by James Simmons <[email protected]>--- .../staging/lustre/lustre/include/lprocfs_status.h | 5 ++ drivers/staging/lustre/lustre/include/lustre_net.h | 8 ++-- drivers/staging/lustre/lustre/include/obd.h | 5 +- drivers/staging/lustre/lustre/llite/dir.c | 12 +---- drivers/staging/lustre/lustre/llite/lcommon_cl.c | 19 +++----- .../staging/lustre/lustre/llite/llite_internal.h | 2 - drivers/staging/lustre/lustre/llite/llite_lib.c | 5 -- drivers/staging/lustre/lustre/llite/llite_nfs.c | 1 - drivers/staging/lustre/lustre/llite/statahead.c | 4 -- drivers/staging/lustre/lustre/mdc/lproc_mdc.c | 20 +------- drivers/staging/lustre/lustre/mdc/mdc_request.c | 13 +++--- .../lustre/lustre/obdclass/lprocfs_status.c | 54 ++++++++++++++++++++++ drivers/staging/lustre/lustre/osc/lproc_osc.c | 46 ------------------ drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c | 2 +- 14 files changed, 82 insertions(+), 114 deletions(-)drivers/staging/lustre/lustre/include/lprocfs_status.h +5
-0@@ -584,6 +584,11 @@ ssize_t lustre_attr_store(struct kobject *kobj, struct attribute *attr,extern const struct sysfs_ops lustre_sysfs_ops; +ssize_t max_pages_per_rpc_show (struct kobject *kobj,struct attribute *attr, +char *buf); +ssize_t max_pages_per_rpc_store (struct kobject *kobj,struct attribute *attr, +const char *buffer,size_t count); +struct root_squash_info ;int lprocfs_wr_root_squash (const char __user *buffer,unsigned long count,struct root_squash_info *squash,char *name);drivers/staging/lustre/lustre/include/lustre_net.h +1
-1@@ -104,15 +104,15 @@* currently supported maximum between peers at connect via ocd_brw_size. */ #define PTLRPC_MAX_BRW_BITS (LNET_MTU_BITS + PTLRPC_BULK_OPS_BITS) -#define PTLRPC_MAX_BRW_SIZE (1 << PTLRPC_MAX_BRW_BITS) +#define PTLRPC_MAX_BRW_SIZE BIT(PTLRPC_MAX_BRW_BITS)#define PTLRPC_MAX_BRW_PAGES (PTLRPC_MAX_BRW_SIZE >> PAGE_SHIFT)
drivers/staging/lustre/lustre/include/lustre_net.h line 115
Quoted 10 lines
drivers/staging/lustre/lustre/include/lustre_net.h +3
-3-#define ONE_MB_BRW_SIZE (1 << LNET_MTU_BITS) -#define MD_MAX_BRW_SIZE (1 << LNET_MTU_BITS) +#define ONE_MB_BRW_SIZE BIT(LNET_MTU_BITS) +#define MD_MAX_BRW_SIZE BIT(LNET_MTU_BITS)#define MD_MAX_BRW_PAGES (MD_MAX_BRW_SIZE >> PAGE_SHIFT)#define DT_MAX_BRW_SIZE PTLRPC_MAX_BRW_SIZE#define DT_MAX_BRW_PAGES (DT_MAX_BRW_SIZE >> PAGE_SHIFT) -#define OFD_MAX_BRW_SIZE (1 << LNET_MTU_BITS) +#define OFD_MAX_BRW_SIZE BIT(LNET_MTU_BITS)
Argg!! No!! Names are important.
"SIZE" means the value is a size, a number. The bit-representation is largely irrelevant, it is the number that is important. BIT(x) returns a single bit - lots of zeros and just one '1' bit. This is not a number, it is a bit pattern.
So settings FOO_SIZE to BIT(bar) is wrong. It is a type error. It uses a bit pattern when a number is expected. The C compiler won't notice, but I will.
When I apply this (which probably won't be until next week), I'll just remove this section of the patch.
Quoted 35 lines
drivers/staging/lustre/lustre/include/lustre_net.h +0
-0/* When PAGE_SIZE is a constant, we can check our arithmetic here with cpp! */ # if ((PTLRPC_MAX_BRW_PAGES & (PTLRPC_MAX_BRW_PAGES -1 )) !=0 )drivers/staging/lustre/lustre/include/obd.h +1
-4@@ -717,11 +717,11 @@ struct md_op_data {struct lu_fid op_fid3;/* 2 extra fids to find conflicting */ struct lu_fid op_fid4;/* to the operation locks. */ u32 op_mds;/* what mds server open will go to */ +u32 op_mode;struct lustre_handle op_handle;s64 op_mod_time;const char *op_name;size_t op_namelen; -__u32 op_mode;struct lmv_stripe_md *op_mea1;struct lmv_stripe_md *op_mea2;__u32 op_suppgids[2 ];@@ -746,9 +746,6 @@ struct md_op_data {/* Used by readdir */ __u64 op_offset; -/* Used by readdir */ -__u32 op_max_pages; -/* used to transfer info between the stacks of MD client * see enum op_cli_flags */ drivers/staging/lustre/lustre/llite/dir.c +0
-0
drivers/staging/lustre/lustre/llite/dir.c int ll_dir_read(struct inode *inode, __u64 *ppos, struct md_op_data *op_data, · line 235
Quoted 10 lines
drivers/staging/lustre/lustre/llite/dir.c +1
-5@@ -231,18 +231,11 @@ int ll_dir_read(struct inode *inode, __u64 *ppos, struct md_op_data *op_data,__u64 ino; hash =le64_to_cpu (ent->lde_hash); -if (hash < pos) -/* -* Skip until we find target hash -* value. -*/ +if (hash < pos)/* Skip until we find target hash */ continue ;
If these comments are really needed (i++; /* increment i */), then they should be:
if (hash < pos)
/* skip until we find target hash */
continue;Quoted 25 lines
drivers/staging/lustre/lustre/llite/dir.c +1
-5namelen =le16_to_cpu (ent->lde_namelen); -if (namelen ==0 ) -/* -* Skip dummy record. -*/ +if (namelen ==0 )/* Skip dummy record. */ continue ;if (is_api32 && is_hash64)@@ -351,7 +344,6 @@ static int ll_readdir(struct file *filp, struct dir_context *ctx) } } } - op_data->op_max_pages = sbi->ll_md_brw_pages; ctx->pos = pos; rc =ll_dir_read (inode, &pos, op_data, ctx); pos = ctx->pos;drivers/staging/lustre/lustre/llite/lcommon_cl.c +0
-0@@ -267,27 +267,22 @@ void cl_inode_fini(struct inode *inode)/** * build inode number from passed @fid
drivers/staging/lustre/lustre/llite/lcommon_cl.c void cl_inode_fini(struct inode *inode) · line 275
Quoted 10 lines
drivers/staging/lustre/lustre/llite/lcommon_cl.c +3
-3*/ -__u64 cl_fid_build_ino (const struct lu_fid *fid,int api32) +u64 cl_fid_build_ino (const struct lu_fid *fid,int api32) {if (BITS_PER_LONG ==32 || api32)return fid_flatten32 (fid); -else -return fid_flatten (fid); + +return fid_flatten (fid);
I preferred that as it was - it makes the either/or nature more obvious.
NeilBrown
Quoted 294 lines
drivers/staging/lustre/lustre/llite/lcommon_cl.c +4
-9}/** * build inode generation from passed @fid. If our FID overflows the 32-bit * inode number then return a non-zero generation to distinguish them. */ -__u32 cl_fid_build_gen (const struct lu_fid *fid) +u32 cl_fid_build_gen (const struct lu_fid *fid) { -__u32 gen; - -if (fid_is_igif (fid)) { - gen =lu_igif_gen (fid); -return gen; - } +if (fid_is_igif (fid)) +return lu_igif_gen (fid); - gen =fid_flatten (fid) >>32 ; -return gen; +return fid_flatten (fid) >>32 ; }drivers/staging/lustre/lustre/llite/llite_internal.h +0
-2@@ -490,8 +490,6 @@ struct ll_sb_info {unsigned int ll_namelen;const struct file_operations *ll_fop; -unsigned int ll_md_brw_pages;/* readdir pages per RPC */ -struct lu_site *ll_site;struct cl_device *ll_cl;/* Statistics */ drivers/staging/lustre/lustre/llite/llite_lib.c +0
-5@@ -343,11 +343,6 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt)if (data->ocd_connect_flags &OBD_CONNECT_64BITHASH ) sbi->ll_flags |=LL_SBI_64BIT_HASH ; -if (data->ocd_connect_flags &OBD_CONNECT_BRW_SIZE ) - sbi->ll_md_brw_pages = data->ocd_brw_size >>PAGE_SHIFT ; -else - sbi->ll_md_brw_pages =1 ; -if (data->ocd_connect_flags &OBD_CONNECT_LAYOUTLOCK ) sbi->ll_flags |=LL_SBI_LAYOUT_LOCK ;drivers/staging/lustre/lustre/llite/llite_nfs.c +0
-1@@ -261,7 +261,6 @@ static int ll_get_name(struct dentry *dentry, char *name, goto out; } - op_data->op_max_pages =ll_i2sbi (dir)->ll_md_brw_pages;inode_lock (dir); rc =ll_dir_read (dir, &pos, op_data, &lgd.ctx);inode_unlock (dir);drivers/staging/lustre/lustre/llite/statahead.c +0
-4@@ -961,8 +961,6 @@ static int ll_statahead_thread(void *arg) goto out; } - op_data->op_max_pages =ll_i2sbi (dir)->ll_md_brw_pages; -while (pos !=MDS_DIR_END_OFF && sai->sai_task) {struct lu_dirpage *dp;struct lu_dirent *ent;@@ -1215,8 +1213,6 @@ static int is_first_dirent(struct inode *dir, struct dentry *dentry)/** * FIXME choose the start offset of the readdir */ - op_data->op_max_pages =ll_i2sbi (dir)->ll_md_brw_pages; - page =ll_get_dir_page (dir, op_data, pos);while (1 ) {drivers/staging/lustre/lustre/mdc/lproc_mdc.c +2
-18@@ -134,6 +134,8 @@ static ssize_t max_mod_rpcs_in_flight_store(struct kobject *kobj, }LUSTRE_RW_ATTR (max_mod_rpcs_in_flight); +LUSTRE_RW_ATTR (max_pages_per_rpc); +#define mdc_conn_uuid_show conn_uuid_showLUSTRE_RO_ATTR (mdc_conn_uuid);@@ -165,24 +167,6 @@ static ssize_t mdc_rpc_stats_seq_write(struct file *file,LPROC_SEQ_FOPS_RO_TYPE (mdc, timeouts);LPROC_SEQ_FOPS_RO_TYPE (mdc, state); -/* -* Note: below sysfs entry is provided, but not currently in use, instead -* sbi->sb_md_brw_size is used, the per obd variable should be used -* when DNE is enabled, and dir pages are managed in MDC layer. -* Don't forget to enable sysfs store function then. -*/ -static ssize_t max_pages_per_rpc_show (struct kobject *kobj, -struct attribute *attr, -char *buf) -{ - struct obd_device *dev = container_of(kobj, struct obd_device, - obd_kset.kobj); -struct client_obd *cli = &dev->u.cli; - -return sprintf (buf,"%d\n" , cli->cl_max_pages_per_rpc); -} -LUSTRE_RO_ATTR (max_pages_per_rpc); -LPROC_SEQ_FOPS_RW_TYPE (mdc, import);LPROC_SEQ_FOPS_RW_TYPE (mdc, pinger_recov);drivers/staging/lustre/lustre/mdc/mdc_request.c +6
-7@@ -1166,17 +1166,17 @@ static int mdc_read_page_remote(void *data, struct page *page0)struct page **page_pool;struct page *page;struct lu_dirpage *dp; -int rd_pgs =0 ;/* number of pages read actually */ -int npages;struct md_op_data *op_data = rp->rp_mod;struct ptlrpc_request *req; -int max_pages = op_data->op_max_pages;struct inode *inode;struct lu_fid *fid; -int i; +int rd_pgs =0 ;/* number of pages read actually */ +int max_pages; +int npages;int rc; +int i; -LASSERT (max_pages >0 && max_pages <=PTLRPC_MAX_BRW_PAGES ); + max_pages = rp->rp_exp->exp_obd->u.cli.cl_max_pages_per_rpc; inode = op_data->op_data; fid = &op_data->op_fid1;LASSERT (inode);@@ -1200,8 +1200,7 @@ static int mdc_read_page_remote(void *data, struct page *page0)if (!rc) {int lu_pgs = req->rq_bulk->bd_nob_transferred; - rd_pgs = (req->rq_bulk->bd_nob_transferred + -PAGE_SIZE -1 ) >>PAGE_SHIFT ; + rd_pgs = (lu_pgs +PAGE_SIZE -1 ) >>PAGE_SHIFT ; lu_pgs >>=LU_PAGE_SHIFT ;LASSERT (!(req->rq_bulk->bd_nob_transferred & ~LU_PAGE_MASK ));drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +54
-0@@ -1785,3 +1785,57 @@ ssize_t lustre_attr_store(struct kobject *kobj, struct attribute *attr, .store = lustre_attr_store, };EXPORT_SYMBOL_GPL (lustre_sysfs_ops); + +ssize_t max_pages_per_rpc_show (struct kobject *kobj,struct attribute *attr, +char *buf) +{ + struct obd_device *dev = container_of(kobj, struct obd_device, + obd_kset.kobj); +struct client_obd *cli = &dev->u.cli; + +return sprintf (buf,"%d\n" , cli->cl_max_pages_per_rpc); +} +EXPORT_SYMBOL (max_pages_per_rpc_show); + +ssize_t max_pages_per_rpc_store (struct kobject *kobj,struct attribute *attr, +const char *buffer,size_t count) +{ + struct obd_device *dev = container_of(kobj, struct obd_device, + obd_kset.kobj); +struct client_obd *cli = &dev->u.cli; +struct obd_connect_data *ocd; +unsigned long long val; +int chunk_mask; +int rc; + + rc =kstrtoull (buffer,10 , &val); +if (rc) +return rc; + +/* if the max_pages is specified in bytes, convert to pages */ +if (val >=ONE_MB_BRW_SIZE ) + val >>=PAGE_SHIFT ; + + rc =lprocfs_climp_check (dev); +if (rc) +return rc; + + ocd = &cli->cl_import->imp_connect_data; + chunk_mask = ~((1 << (cli->cl_chunkbits -PAGE_SHIFT )) -1 ); +/* max_pages_per_rpc must be chunk aligned */ + val = (val + ~chunk_mask) & chunk_mask; +if (!val || (ocd->ocd_brw_size && + val > ocd->ocd_brw_size >>PAGE_SHIFT )) { +up_read (&dev->u.cli.cl_sem); +return -ERANGE ; + } + +spin_lock (&cli->cl_loi_list_lock); + cli->cl_max_pages_per_rpc = val; +client_adjust_max_dirty (cli); +spin_unlock (&cli->cl_loi_list_lock); + +up_read (&dev->u.cli.cl_sem); +return count; +} +EXPORT_SYMBOL (max_pages_per_rpc_store);drivers/staging/lustre/lustre/osc/lproc_osc.c +0
-46@@ -570,52 +570,6 @@ static ssize_t destroys_in_flight_show(struct kobject *kobj, atomic_read(&obd->u.cli.cl_destroy_in_flight)); }LUSTRE_RO_ATTR (destroys_in_flight); - -static ssize_t max_pages_per_rpc_show (struct kobject *kobj, -struct attribute *attr, -char *buf) -{ - struct obd_device *dev = container_of(kobj, struct obd_device, - obd_kset.kobj); -struct client_obd *cli = &dev->u.cli; - -return sprintf (buf,"%d\n" , cli->cl_max_pages_per_rpc); -} - -static ssize_t max_pages_per_rpc_store (struct kobject *kobj, -struct attribute *attr, -const char *buffer, -size_t count) -{ - struct obd_device *dev = container_of(kobj, struct obd_device, - obd_kset.kobj); -struct client_obd *cli = &dev->u.cli; -struct obd_connect_data *ocd = &cli->cl_import->imp_connect_data; -int chunk_mask, rc; -unsigned long long val; - - rc =kstrtoull (buffer,10 , &val); -if (rc) -return rc; - -/* if the max_pages is specified in bytes, convert to pages */ -if (val >=ONE_MB_BRW_SIZE ) - val >>=PAGE_SHIFT ; - - chunk_mask = ~((1 << (cli->cl_chunkbits -PAGE_SHIFT )) -1 ); -/* max_pages_per_rpc must be chunk aligned */ - val = (val + ~chunk_mask) & chunk_mask; -if (!val || (ocd->ocd_brw_size && - val > ocd->ocd_brw_size >>PAGE_SHIFT )) { -return -ERANGE ; - } -spin_lock (&cli->cl_loi_list_lock); - cli->cl_max_pages_per_rpc = val; -client_adjust_max_dirty (cli); -spin_unlock (&cli->cl_loi_list_lock); - -return count; -}LUSTRE_RW_ATTR (max_pages_per_rpc);static int osc_unstable_stats_seq_show (struct seq_file *m,void *v)drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c +1
-1@@ -232,7 +232,7 @@ static unsigned long enc_pools_shrink_count(struct shrinker *s, }LASSERT (page_pools.epp_idle_idx <=IDLE_IDX_MAX ); -return max ((int )page_pools.epp_free_pages -PTLRPC_MAX_BRW_PAGES ,0 ) * +return max (page_pools.epp_free_pages -PTLRPC_MAX_BRW_PAGES ,0UL ) * (IDLE_IDX_MAX - page_pools.epp_idle_idx) /IDLE_IDX_MAX ; }Signature · 1 line
1.8.3.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180918/eb49df23/attachment.sig>
PATCH 11/30 lustre: mdc: allow setting readdir RPC size parameter
Quoted 33 lines · NeilBrown
Quoted 13 lines · James Simmons
From: Andreas Dilger <[email protected]>
drivers/staging/lustre/lustre/include/lustre_net.h +1
-1@@ -104,15 +104,15 @@* currently supported maximum between peers at connect via ocd_brw_size. */ #define PTLRPC_MAX_BRW_BITS (LNET_MTU_BITS + PTLRPC_BULK_OPS_BITS) -#define PTLRPC_MAX_BRW_SIZE (1 << PTLRPC_MAX_BRW_BITS) +#define PTLRPC_MAX_BRW_SIZE BIT(PTLRPC_MAX_BRW_BITS)#define PTLRPC_MAX_BRW_PAGES (PTLRPC_MAX_BRW_SIZE >> PAGE_SHIFT)drivers/staging/lustre/lustre/include/lustre_net.h line 115
Quoted 10 lines
drivers/staging/lustre/lustre/include/lustre_net.h +3
-3-#define ONE_MB_BRW_SIZE (1 << LNET_MTU_BITS) -#define MD_MAX_BRW_SIZE (1 << LNET_MTU_BITS) +#define ONE_MB_BRW_SIZE BIT(LNET_MTU_BITS) +#define MD_MAX_BRW_SIZE BIT(LNET_MTU_BITS)#define MD_MAX_BRW_PAGES (MD_MAX_BRW_SIZE >> PAGE_SHIFT)#define DT_MAX_BRW_SIZE PTLRPC_MAX_BRW_SIZE#define DT_MAX_BRW_PAGES (DT_MAX_BRW_SIZE >> PAGE_SHIFT) -#define OFD_MAX_BRW_SIZE (1 << LNET_MTU_BITS) +#define OFD_MAX_BRW_SIZE BIT(LNET_MTU_BITS)Argg!! No!! Names are important.
"SIZE" means the value is a size, a number. The bit-representation is largely irrelevant, it is the number that is important. BIT(x) returns a single bit - lots of zeros and just one '1' bit. This is not a number, it is a bit pattern.
Quoted 5 lines
So settings
FOO_SIZEto BIT(bar) is wrong. It is a type error. It uses a bit pattern when a number is expected. The C compiler won't notice, but I will.When I apply this (which probably won't be until next week), I'll just remove this section of the patch.
Just to confirm, my original patch didn't have these BIT() macros in it, and I agree with your statements, so I'm fine with you removing them again.
Quoted 11 lines
Quoted 11 lines
drivers/staging/lustre/lustre/llite/lcommon_cl.c +1
-1@@ -267,27 +267,22 @@ void cl_inode_fini(struct inode *inode)/** * build inode number from passed @fid */ -__u64 cl_fid_build_ino (const struct lu_fid *fid,int api32) +u64 cl_fid_build_ino (const struct lu_fid *fid,int api32) {
Quoted 8 lines
drivers/staging/lustre/lustre/llite/lcommon_cl.c void cl_inode_fini(struct inode *inode) · line 275
Quoted 6 lines
drivers/staging/lustre/lustre/llite/lcommon_cl.c +2
-2if (BITS_PER_LONG ==32 || api32)return fid_flatten32 (fid); -else -return fid_flatten (fid); + +return fid_flatten (fid);I preferred that as it was - it makes the either/or nature more obvious.
Kernel style generally recommends no "else" after a return, and checkpatch.pl will complain in this case.
Cheers, Andreas
---
Andreas Dilger
Principal Lustre Architect
Whamcloud
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 235 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180920/8d434fe1/attachment.sig>
PATCH 11/30 lustre: mdc: allow setting readdir RPC size parameter
Quoted 37 lines · Andreas Dilger
Quoted 36 lines · NeilBrown
Quoted 13 lines · James Simmons
From: Andreas Dilger <[email protected]>
drivers/staging/lustre/lustre/include/lustre_net.h +1
-1@@ -104,15 +104,15 @@* currently supported maximum between peers at connect via ocd_brw_size. */ #define PTLRPC_MAX_BRW_BITS (LNET_MTU_BITS + PTLRPC_BULK_OPS_BITS) -#define PTLRPC_MAX_BRW_SIZE (1 << PTLRPC_MAX_BRW_BITS) +#define PTLRPC_MAX_BRW_SIZE BIT(PTLRPC_MAX_BRW_BITS)#define PTLRPC_MAX_BRW_PAGES (PTLRPC_MAX_BRW_SIZE >> PAGE_SHIFT)drivers/staging/lustre/lustre/include/lustre_net.h line 115
Quoted 10 lines
drivers/staging/lustre/lustre/include/lustre_net.h +3
-3-#define ONE_MB_BRW_SIZE (1 << LNET_MTU_BITS) -#define MD_MAX_BRW_SIZE (1 << LNET_MTU_BITS) +#define ONE_MB_BRW_SIZE BIT(LNET_MTU_BITS) +#define MD_MAX_BRW_SIZE BIT(LNET_MTU_BITS)#define MD_MAX_BRW_PAGES (MD_MAX_BRW_SIZE >> PAGE_SHIFT)#define DT_MAX_BRW_SIZE PTLRPC_MAX_BRW_SIZE#define DT_MAX_BRW_PAGES (DT_MAX_BRW_SIZE >> PAGE_SHIFT) -#define OFD_MAX_BRW_SIZE (1 << LNET_MTU_BITS) +#define OFD_MAX_BRW_SIZE BIT(LNET_MTU_BITS)Argg!! No!! Names are important.
"SIZE" means the value is a size, a number. The bit-representation is largely irrelevant, it is the number that is important. BIT(x) returns a single bit - lots of zeros and just one '1' bit. This is not a number, it is a bit pattern.So settings
FOO_SIZEto BIT(bar) is wrong. It is a type error. It uses a bit pattern when a number is expected. The C compiler won't notice, but I will.
Quoted 6 lines
Quoted 2 lines
When I apply this (which probably won't be until next week), I'll just remove this section of the patch.
Just to confirm, my original patch didn't have these
BIT()macros in it, and I agree with your statements, so I'm fine with you removing them again.
Good. They are gone.
Quoted 21 lines
Quoted 12 lines
Quoted 12 lines
drivers/staging/lustre/lustre/llite/lcommon_cl.c +1
-1@@ -267,27 +267,22 @@ void cl_inode_fini(struct inode *inode)/** * build inode number from passed @fid */ -__u64 cl_fid_build_ino (const struct lu_fid *fid,int api32) +u64 cl_fid_build_ino (const struct lu_fid *fid,int api32) {Quoted 8 lines
drivers/staging/lustre/lustre/llite/lcommon_cl.c void cl_inode_fini(struct inode *inode) · line 275
Quoted 6 lines
drivers/staging/lustre/lustre/llite/lcommon_cl.c +2
-2if (BITS_PER_LONG ==32 || api32)return fid_flatten32 (fid); -else -return fid_flatten (fid); + +return fid_flatten (fid);I preferred that as it was - it makes the either/or nature more obvious.
Quoted 1 line
Kernel style generally recommends no "else" after a return, and checkpatch.pl will complain in this case.
I just ran
checkpatch.pl --file drivers/staging/lustre/lustre/llite/lcommon_cl.c
without this patch applied, and it didn't complain.
I've removed this section of the patch because it seems to be unrelated to the rest of the patch, and because I don't like it.
Thanks,
NeilBrown
Quoted 6 lines
Cheers, Andreas
---
Andreas Dilger
Principal Lustre Architect
Whamcloud
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180924/a702ecf6/attachment.sig>
PATCH 11/30 lustre: mdc: allow setting readdir RPC size parameter
In reply to Andreas DilgerQuoted 35 lines · NeilBrown
Quoted 33 lines · James Simmons
Quoted 14 lines
From: Andreas Dilger <[email protected]>
drivers/staging/lustre/lustre/include/lustre_net.h +1
-1@@ -104,15 +104,15 @@* currently supported maximum between peers at connect via ocd_brw_size. */ #define PTLRPC_MAX_BRW_BITS (LNET_MTU_BITS + PTLRPC_BULK_OPS_BITS) -#define PTLRPC_MAX_BRW_SIZE (1 << PTLRPC_MAX_BRW_BITS) +#define PTLRPC_MAX_BRW_SIZE BIT(PTLRPC_MAX_BRW_BITS)#define PTLRPC_MAX_BRW_PAGES (PTLRPC_MAX_BRW_SIZE >> PAGE_SHIFT)drivers/staging/lustre/lustre/include/lustre_net.h line 115
Quoted 10 lines
drivers/staging/lustre/lustre/include/lustre_net.h +3
-3-#define ONE_MB_BRW_SIZE (1 << LNET_MTU_BITS) -#define MD_MAX_BRW_SIZE (1 << LNET_MTU_BITS) +#define ONE_MB_BRW_SIZE BIT(LNET_MTU_BITS) +#define MD_MAX_BRW_SIZE BIT(LNET_MTU_BITS)#define MD_MAX_BRW_PAGES (MD_MAX_BRW_SIZE >> PAGE_SHIFT)#define DT_MAX_BRW_SIZE PTLRPC_MAX_BRW_SIZE#define DT_MAX_BRW_PAGES (DT_MAX_BRW_SIZE >> PAGE_SHIFT) -#define OFD_MAX_BRW_SIZE (1 << LNET_MTU_BITS) +#define OFD_MAX_BRW_SIZE BIT(LNET_MTU_BITS)Argg!! No!! Names are important.
"SIZE" means the value is a size, a number. The bit-representation is largely irrelevant, it is the number that is important. BIT(x) returns a single bit - lots of zeros and just one '1' bit. This is not a number, it is a bit pattern.
Quoted 8 lines
Quoted 5 lines
So settings
FOO_SIZEto BIT(bar) is wrong. It is a type error. It uses a bit pattern when a number is expected. The C compiler won't notice, but I will.When I apply this (which probably won't be until next week), I'll just remove this section of the patch.
Just to confirm, my original patch didn't have these
BIT()macros in it, and I agree with your statements, so I'm fine with you removing them again.
That was my attempting to handle a checkpatch complaint with this patch. I do see your point in this. Still I like to keep the checkpatch numbers down to to remove a potential barrier to the acceptance into the fs tree. We could replace (1 << LNET_MTU_BITS) with LNET_MTU which is the same value. I will latter post a separate patch to fix those checkpatch issues up.
Quoted 35 lines
Quoted 11 lines
Quoted 11 lines
drivers/staging/lustre/lustre/llite/lcommon_cl.c +1
-1@@ -267,27 +267,22 @@ void cl_inode_fini(struct inode *inode)/** * build inode number from passed @fid */ -__u64 cl_fid_build_ino (const struct lu_fid *fid,int api32) +u64 cl_fid_build_ino (const struct lu_fid *fid,int api32) {Quoted 8 lines
drivers/staging/lustre/lustre/llite/lcommon_cl.c void cl_inode_fini(struct inode *inode) · line 275
Quoted 6 lines
drivers/staging/lustre/lustre/llite/lcommon_cl.c +2
-2if (BITS_PER_LONG ==32 || api32)return fid_flatten32 (fid); -else -return fid_flatten (fid); + +return fid_flatten (fid);I preferred that as it was - it makes the either/or nature more obvious.
Kernel style generally recommends no "else" after a return, and checkpatch.pl will complain in this case.
Cheers, Andreas
---
Andreas Dilger
Principal Lustre Architect
Whamcloud
PATCH 12/30 lustre: kuc: initialize kkuc_groups at module init time
In reply to James SimmonsFrom: "John L. Hammond" <[email protected]>
Some kkuc functions use kkuc_groups[group].next == NULL to test for an empty group list. This is incorrect if the group was previously added to but not empty. Remove all next == NULL tests and use module load time initialization of the kkuc_groups array.
WC-bug-id: https://jira.whamcloud.com/browse/LU-9306
Reviewed-on: https://review.whamcloud.com/26883
--- .../lustre/lustre/include/lustre_kernelcomm.h | 1 + drivers/staging/lustre/lustre/obdclass/class_obd.c | 3 ++ .../staging/lustre/lustre/obdclass/kernelcomm.c | 38 +++++++++++++++------- 3 files changed, 30 insertions(+), 12 deletions(-)
drivers/staging/lustre/lustre/include/lustre_kernelcomm.h +1 -0
@@ -45,6 +45,7 @@typedef int (*libcfs_kkuc_cb_t )(void *data,void *cb_arg);/* Kernel methods */ +void libcfs_kkuc_init (void );int libcfs_kkuc_msg_put (struct file *fp,void *payload);int libcfs_kkuc_group_put (unsigned int group,void *payload); int libcfs_kkuc_group_add(struct file *fp, int uid, unsigned int group,
drivers/staging/lustre/lustre/obdclass/class_obd.c +3 -0
@@ -42,6 +42,7 @@#include <obd_class.h> #include <uapi/linux/lnet/lnetctl.h> #include <lustre_debug.h> +#include <lustre_kernelcomm.h> #include <lprocfs_status.h> #include <linux/list.h> #include <cl_object.h>
@@ -664,6 +665,8 @@ static int __init obdclass_init(void)if (err)return err; +libcfs_kkuc_init (); + err =obd_zombie_impexp_init ();if (err)return err;
drivers/staging/lustre/lustre/obdclass/kernelcomm.c +26 -12
@@ -96,10 +96,23 @@ struct kkuc_reg {char kr_data[0 ]; }; -static struct list_head kkuc_groups[KUC_GRP_MAX +1 ] = {}; +static struct list_head kkuc_groups[KUC_GRP_MAX +1 ];/* Protect message sending against remove and adds */ static DECLARE_RWSEM (kg_sem); +static inline bool libcfs_kkuc_group_is_valid (int group) +{ +return 0 <= group && group <ARRAY_SIZE (kkuc_groups); +} + +void libcfs_kkuc_init (void ) +{ +int group; + +for (group =0 ; group <ARRAY_SIZE (kkuc_groups); group++) +INIT_LIST_HEAD (&kkuc_groups[group]); +} +/** Add a receiver to a broadcast group * @param filp pipe to write into * @param uid identifier for this receiver
@@ -111,7 +124,7 @@ int libcfs_kkuc_group_add(struct file *filp, int uid, unsigned int group, {struct kkuc_reg *reg; -if (group >KUC_GRP_MAX ) { +if (!libcfs_kkuc_group_is_valid (group)) {CDEBUG (D_WARNING ,"Kernelcomm: bad group %d\n" , group);return -EINVAL ; }
@@ -130,8 +143,6 @@ int libcfs_kkuc_group_add(struct file *filp, int uid, unsigned int group,memcpy (reg->kr_data, data, data_len);down_write (&kg_sem); -if (!kkuc_groups[group].next) -INIT_LIST_HEAD (&kkuc_groups[group]);list_add (®->kr_chain, &kkuc_groups[group]);up_write (&kg_sem);
@@ -145,8 +156,10 @@ int libcfs_kkuc_group_rem(int uid, unsigned int group) {struct kkuc_reg *reg, *next; -if (!kkuc_groups[group].next) -return 0 ; +if (!libcfs_kkuc_group_is_valid (group)) { +CDEBUG (D_WARNING ,"Kernelcomm: bad group %d\n" , group); +return -EINVAL ; + }if (!uid) {/* Broadcast a shutdown message */
@@ -182,9 +195,14 @@ int libcfs_kkuc_group_put(unsigned int group, void *payload)int rc =0 ;int one_success =0 ; +if (!libcfs_kkuc_group_is_valid (group)) { +CDEBUG (D_WARNING ,"Kernelcomm: bad group %d\n" , group); +return -EINVAL ; + } +down_write (&kg_sem); -if (unlikely (!kkuc_groups[group].next) || +if (unlikely (list_empty (&kkuc_groups[group])) ||unlikely (OBD_FAIL_CHECK (OBD_FAIL_MDS_HSM_CT_REGISTER_NET ))) {/* no agent have fully registered, CDT will retry */ up_write (&kg_sem);
@@ -227,15 +245,11 @@ int libcfs_kkuc_group_foreach(unsigned int group, libcfs_kkuc_cb_t cb_func,struct kkuc_reg *reg;int rc =0 ; -if (group >KUC_GRP_MAX ) { +if (!libcfs_kkuc_group_is_valid (group)) {CDEBUG (D_WARNING ,"Kernelcomm: bad group %d\n" , group);return -EINVAL ; } -/* no link for this group */ -if (!kkuc_groups[group].next) -return 0 ; -down_read (&kg_sem);list_for_each_entry (reg, &kkuc_groups[group], kr_chain) {if (reg->kr_fp)
Signature · 1 line
1.8.3.1
PATCH 12/30 lustre: kuc: initialize kkuc_groups at module init time
Quoted 62 lines · James Simmons
From: "John L. Hammond" <[email protected]>
Some kkuc functions use kkuc_groups[group].next == NULL to test for an empty group list. This is incorrect if the group was previously added to but not empty. Remove all next == NULL tests and use module load time initialization of the
kkuc_groupsarray.Signed-off-by John L. Hammond <[email protected]>WC-bug-id: https://jira.whamcloud.com/browse/LU-9306
Reviewed-on: https://review.whamcloud.com/26883Reviewed-by Frank Zago <[email protected]>Reviewed-by Faccini Bruno <[email protected]>Reviewed-by Henri Doreau <[email protected]>Reviewed-by Quentin Bouget <[email protected]>Reviewed-by Oleg Drokin <[email protected]>Signed-off-by James Simmons <[email protected]>--- .../lustre/lustre/include/lustre_kernelcomm.h | 1 + drivers/staging/lustre/lustre/obdclass/class_obd.c | 3 ++ .../staging/lustre/lustre/obdclass/kernelcomm.c | 38 +++++++++++++++------- 3 files changed, 30 insertions(+), 12 deletions(-)drivers/staging/lustre/lustre/include/lustre_kernelcomm.h +1
-0@@ -45,6 +45,7 @@typedef int (*libcfs_kkuc_cb_t )(void *data,void *cb_arg);/* Kernel methods */ +void libcfs_kkuc_init (void );int libcfs_kkuc_msg_put (struct file *fp,void *payload);int libcfs_kkuc_group_put (unsigned int group,void *payload); int libcfs_kkuc_group_add(struct file *fp, int uid, unsigned int group,drivers/staging/lustre/lustre/obdclass/class_obd.c +3
-0@@ -42,6 +42,7 @@#include <obd_class.h> #include <uapi/linux/lnet/lnetctl.h> #include <lustre_debug.h> +#include <lustre_kernelcomm.h> #include <lprocfs_status.h> #include <linux/list.h> #include <cl_object.h> @@ -664,6 +665,8 @@ static int __init obdclass_init(void)if (err)return err; +libcfs_kkuc_init (); + err =obd_zombie_impexp_init ();if (err)return err;drivers/staging/lustre/lustre/obdclass/kernelcomm.c +0
-0@@ -96,10 +96,23 @@ struct kkuc_reg {char kr_data[0 ]; };
drivers/staging/lustre/lustre/obdclass/kernelcomm.c struct kkuc_reg { · line 106
Quoted 10 lines
drivers/staging/lustre/lustre/obdclass/kernelcomm.c +5
-1-static struct list_head kkuc_groups[KUC_GRP_MAX +1 ] = {}; +static struct list_head kkuc_groups[KUC_GRP_MAX +1 ];/* Protect message sending against remove and adds */ static DECLARE_RWSEM (kg_sem); +static inline bool libcfs_kkuc_group_is_valid (int group) +{ +return 0 <= group && group <ARRAY_SIZE (kkuc_groups); +}
libcfs_kkuc_group_is_valid() is only ever passed an unsigned int. So I've changed it to expect one, and removed the comparison against 0 which is now pointless.
Thanks,
NeilBrown
Quoted 78 lines
drivers/staging/lustre/lustre/obdclass/kernelcomm.c +21
-11+ +void libcfs_kkuc_init (void ) +{ +int group; + +for (group =0 ; group <ARRAY_SIZE (kkuc_groups); group++) +INIT_LIST_HEAD (&kkuc_groups[group]); +} +/** Add a receiver to a broadcast group * @param filp pipe to write into * @param uid identifier for this receiver @@ -111,7 +124,7 @@ int libcfs_kkuc_group_add(struct file *filp, int uid, unsigned int group, {struct kkuc_reg *reg; -if (group >KUC_GRP_MAX ) { +if (!libcfs_kkuc_group_is_valid (group)) {CDEBUG (D_WARNING ,"Kernelcomm: bad group %d\n" , group);return -EINVAL ; }@@ -130,8 +143,6 @@ int libcfs_kkuc_group_add(struct file *filp, int uid, unsigned int group,memcpy (reg->kr_data, data, data_len);down_write (&kg_sem); -if (!kkuc_groups[group].next) -INIT_LIST_HEAD (&kkuc_groups[group]);list_add (®->kr_chain, &kkuc_groups[group]);up_write (&kg_sem);@@ -145,8 +156,10 @@ int libcfs_kkuc_group_rem(int uid, unsigned int group) {struct kkuc_reg *reg, *next; -if (!kkuc_groups[group].next) -return 0 ; +if (!libcfs_kkuc_group_is_valid (group)) { +CDEBUG (D_WARNING ,"Kernelcomm: bad group %d\n" , group); +return -EINVAL ; + }if (!uid) {/* Broadcast a shutdown message */ @@ -182,9 +195,14 @@ int libcfs_kkuc_group_put(unsigned int group, void *payload)int rc =0 ;int one_success =0 ; +if (!libcfs_kkuc_group_is_valid (group)) { +CDEBUG (D_WARNING ,"Kernelcomm: bad group %d\n" , group); +return -EINVAL ; + } +down_write (&kg_sem); -if (unlikely (!kkuc_groups[group].next) || +if (unlikely (list_empty (&kkuc_groups[group])) ||unlikely (OBD_FAIL_CHECK (OBD_FAIL_MDS_HSM_CT_REGISTER_NET ))) {/* no agent have fully registered, CDT will retry */ up_write (&kg_sem);@@ -227,15 +245,11 @@ int libcfs_kkuc_group_foreach(unsigned int group, libcfs_kkuc_cb_t cb_func,struct kkuc_reg *reg;int rc =0 ; -if (group >KUC_GRP_MAX ) { +if (!libcfs_kkuc_group_is_valid (group)) {CDEBUG (D_WARNING ,"Kernelcomm: bad group %d\n" , group);return -EINVAL ; } -/* no link for this group */ -if (!kkuc_groups[group].next) -return 0 ; -down_read (&kg_sem);list_for_each_entry (reg, &kkuc_groups[group], kr_chain) {if (reg->kr_fp)Signature · 1 line
1.8.3.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180924/dd16318d/attachment.sig>
PATCH 13/30 lustre: ldlm: GPF in _ldlm_lock_debug()
In reply to James SimmonsFrom: Andriy Skulysh <[email protected]>
Lock's resource can change on a client. Take a resource reference under spinlock to print debug information.
WC-bug-id: https://jira.whamcloud.com/browse/LU-7062
Xyratex-bug-id: MRP-2760
Reviewed-on: https://review.whamcloud.com/16139
--- drivers/staging/lustre/lustre/include/lustre_dlm.h | 1 + drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 11 +++++++++-- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-)
drivers/staging/lustre/lustre/include/lustre_dlm.h +1 -0
@@ -1186,6 +1186,7 @@ struct ldlm_resource *ldlm_resource_get(struct ldlm_namespace *ns,struct ldlm_resource *parent, const struct ldlm_res_id *, enum ldlm_type type, int create); +struct ldlm_resource *ldlm_resource_getref (struct ldlm_resource *res);void ldlm_resource_putref (struct ldlm_resource *res); void ldlm_resource_add_lock(struct ldlm_resource *res, struct list_head *head,
drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +9 -2
@@ -1981,10 +1981,16 @@ void _ldlm_lock_debug(struct ldlm_lock *lock,struct libcfs_debug_msg_data *msgdata, const char *fmt, ...) { - va_list args; struct obd_export *exp = lock->l_export; -struct ldlm_resource *resource = lock->l_resource; +struct ldlm_resource *resource =NULL ;char *nid ="local" ; +va_list args; + +if (spin_trylock (&lock->l_lock)) { +if (lock->l_resource) + resource =ldlm_resource_getref (lock->l_resource); +spin_unlock (&lock->l_lock); + }va_start (args, fmt);
@@ -2099,5 +2105,6 @@ void _ldlm_lock_debug(struct ldlm_lock *lock,break ; }va_end (args); +ldlm_resource_putref (resource); }EXPORT_SYMBOL (_ldlm_lock_debug);
drivers/staging/lustre/lustre/ldlm/ldlm_resource.c +1 -1
@@ -402,7 +402,7 @@ static int ldlm_namespace_debugfs_register(struct ldlm_namespace *ns)#undef MAX_STRING_SIZE -static struct ldlm_resource *ldlm_resource_getref (struct ldlm_resource *res) +struct ldlm_resource *ldlm_resource_getref (struct ldlm_resource *res) {LASSERT (res);LASSERT (res !=LP_POISON );
Signature · 1 line
1.8.3.1
PATCH 14/30 lustre: ldlm: cond_resched in ldlm_bl_thread_main
In reply to James SimmonsFrom: Patrick Farrell <[email protected]>
When clearing all of the ldlm LRUs (as Cray does at the end of a job), a ldlm_bl_work_item is generated for each namespace and then they are placed on a list for the ldlm_bl threads to iterate over.
If the number of namespaces greatly exceeds the number of ldlm_bl threads, a given thread will iterate over many namespaces without sleeping looking for work. This can go on for an extremely long time and result in an RCU stall.
This patch adds a cond_resched() between completing one work item and looking for the next. This is a fairly cheap operation, as it will only schedule if there is an interrupt waiting, and it will not be called too much - Even the largest file systems have < 100 namespaces per ldlm_bl_thread currently.
WC-bug-id: https://jira.whamcloud.com/browse/LU-8307
Reviewed-on: https://review.whamcloud.com/20888
--- drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c +6 -0
@@ -856,6 +856,12 @@ static int ldlm_bl_thread_main(void *arg)if (rc ==LDLM_ITER_STOP )break ; + +/* If there are many namespaces, we will not sleep waiting for +* work, and must do a cond_resched to avoid holding the CPU +* for too long +*/ +cond_resched (); }atomic_dec (&blp->blp_num_threads);
Signature · 1 line
1.8.3.1
PATCH 15/30 lustre: ptlrpc: drain "ptlrpc_request_buffer_desc" objects
In reply to James SimmonsFrom: Bruno Faccini <[email protected]>
Prior to this patch, new "ptlrpc_request_buffer_desc" could be additionally allocated upon need by ptlrpc_check_rqbd_pool(), but will never be freed until OST umount/stop by ptlrpc_service_purge_all(). Now try to release some of them when possible.
WC-bug-id: https://jira.whamcloud.com/browse/LU-9372
Reviewed-on: https://review.whamcloud.com/26752
--- drivers/staging/lustre/lustre/ptlrpc/service.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/ptlrpc/service.c +12 -2
@@ -802,11 +802,21 @@ static void ptlrpc_server_drop_request(struct ptlrpc_request *req)spin_lock (&svcpt->scp_lock);/* * now all reqs including the embedded req has been -* disposed, schedule request buffer for re-use. +* disposed, schedule request buffer for re-use +* or free it to drain some in excess. */ LASSERT (atomic_read (&rqbd->rqbd_req.rq_refcount) ==0 ); -list_add_tail (&rqbd->rqbd_list, &svcpt->scp_rqbd_idle); +if (svcpt->scp_nrqbds_posted >= svc->srv_nbuf_per_group && + !test_req_buffer_pressure) { +/* like in ptlrpc_free_rqbd() */ + svcpt->scp_nrqbds_total--; +kvfree (rqbd->rqbd_buffer); +kfree (rqbd); + }else { +list_add_tail (&rqbd->rqbd_list, + &svcpt->scp_rqbd_idle); + } }spin_unlock (&svcpt->scp_lock);
Signature · 1 line
1.8.3.1
PATCH 16/30 lustre: lnet: Change sock_create() to sock_create_kern()
In reply to James SimmonsFrom: Doug Oucharek <[email protected]>
Changing all calls from sock_create() to sock_create_kern().
WC-bug-id: https://jira.whamcloud.com/browse/LU-9456
Reviewed-on: https://review.whamcloud.com/26958
--- drivers/staging/lustre/lnet/lnet/lib-socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lnet/lnet/lib-socket.c +1 -1
@@ -157,7 +157,7 @@/* All errors are fatal except bind failure if the port is in use */ *fatal =1 ; - rc =sock_create (PF_INET ,SOCK_STREAM ,0 , &sock); + rc =sock_create_kern (&init_net,PF_INET ,SOCK_STREAM ,0 , &sock); *sockp = sock;if (rc) {CERROR ("Can't create socket: %d\n" , rc);
Signature · 1 line
1.8.3.1
PATCH 17/30 lustre: llite: protect ll_dentry_data modification
In reply to James SimmonsFrom: Andriy Skulysh <[email protected]>
The ll_dentry_data bitfields modification should be protected by a spinlock.
WC-bug-id: https://jira.whamcloud.com/browse/LU-9241
Seagate-bug-id: MRP-4257
Reviewed-on: https://review.whamcloud.com/26109
--- drivers/staging/lustre/lustre/llite/llite_nfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/lustre/lustre/llite/llite_nfs.c +2 -1
@@ -171,8 +171,9 @@ struct lustre_nfs_fid {* we came from NFS and so opencache needs to be * enabled for this one */ +spin_lock (&result->d_lock);ll_d2d (result)->lld_nfs_dentry =1 ; - +spin_unlock (&result->d_lock);return result; }
Signature · 1 line
1.8.3.1
PATCH 17/30 lustre: llite: protect ll_dentry_data modification
Quoted 23 lines · James Simmons
From: Andriy Skulysh <[email protected]>
The
ll_dentry_databitfields modification should be protected by a spinlock.Signed-off-by Andriy Skulysh <[email protected]>Signed-off-by Lai Siyao <[email protected]>WC-bug-id: https://jira.whamcloud.com/browse/LU-9241
Seagate-bug-id: MRP-4257
Reviewed-on: https://review.whamcloud.com/26109Reviewed-by Niu Yawei <[email protected]>Reviewed-by Bobi Jam <[email protected]>Reviewed-by Oleg Drokin <[email protected]>Signed-off-by James Simmons <[email protected]>--- drivers/staging/lustre/lustre/llite/llite_nfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/staging/lustre/lustre/llite/llite_nfs.c +0
-0
drivers/staging/lustre/lustre/llite/llite_nfs.c struct lustre_nfs_fid { · line 178
Quoted 9 lines
drivers/staging/lustre/lustre/llite/llite_nfs.c +2
-1@@ -171,8 +171,9 @@ struct lustre_nfs_fid {* we came from NFS and so opencache needs to be * enabled for this one */ +spin_lock (&result->d_lock);ll_d2d (result)->lld_nfs_dentry =1 ; - +spin_unlock (&result->d_lock);return result; }
This is a bit weird....
I agree that having a spinlock is needed as the compiler does an R/M/W to update the bitfield, and that could race with updats to lld_invalid (and I think that is a good arguement to avoid bitfields in shared structures).
However lld_nfs_dentry is never used. The only use was removed by
Commit: c1b66fccf986 ("staging: lustre: fid: do open-by-fid by default")
The corresponding commit upstream is
Commit: cb85c0364fd8 ("LU-3544 fid: do open-by-fid by default")
and that commit doesn't remove the use of lld_nfs_dentry. Maybe because lld_nfs_dentry didn't exist then - it wasn't added until later by 65d0add6057b138.
So do we need to bring lld_nfs_dentry back?
Thanks,
NeilBrown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180924/9c40f448/attachment-0001.sig>
PATCH 17/30 lustre: llite: protect ll_dentry_data modification
Quoted 45 lines
Quoted 24 lines
From: Andriy Skulysh <[email protected]>
The
ll_dentry_databitfields modification should be protected by a spinlock.Signed-off-by Andriy Skulysh <[email protected]>Signed-off-by Lai Siyao <[email protected]>WC-bug-id: https://jira.whamcloud.com/browse/LU-9241
Seagate-bug-id: MRP-4257
Reviewed-on: https://review.whamcloud.com/26109Reviewed-by Niu Yawei <[email protected]>Reviewed-by Bobi Jam <[email protected]>Reviewed-by Oleg Drokin <[email protected]>Signed-off-by James Simmons <[email protected]>--- drivers/staging/lustre/lustre/llite/llite_nfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/staging/lustre/lustre/llite/llite_nfs.c +0
-0drivers/staging/lustre/lustre/llite/llite_nfs.c struct lustre_nfs_fid { · line 178
Quoted 9 lines
drivers/staging/lustre/lustre/llite/llite_nfs.c +2
-1@@ -171,8 +171,9 @@ struct lustre_nfs_fid {* we came from NFS and so opencache needs to be * enabled for this one */ +spin_lock (&result->d_lock);ll_d2d (result)->lld_nfs_dentry =1 ; - +spin_unlock (&result->d_lock);return result; }This is a bit weird....
I agree that having a spinlock is needed as the compiler does an R/M/W to update the bitfield, and that could race with updats tolld_invalid(and I think that is a good arguement to avoid bitfields in shared structures).However
lld_nfs_dentryis never used. The only use was removed byCommit:
c1b66fccf986("staging: lustre: fid: do open-by-fid by default")The corresponding commit upstream is
Quoted 7 lines
Commit:
cb85c0364fd8("LU-3544 fid: do open-by-fid by default")and that commit doesn't remove the use of
lld_nfs_dentry. Maybe becauselld_nfs_dentrydidn't exist then - it wasn't added until later by65d0add6057b138.So do we need to bring
lld_nfs_dentryback?
Ouch. That got removed by mistake by me ;-( Yes it should come back. I will create a patch to fix that. My bad.
PATCH 18/30 lustre: llite: llite.stat_blocksize param for fixed st_blksize
In reply to James SimmonsFrom: Andrew Perepechko <[email protected]>
llite.stat_blocksize is added to allow configurable st_blksize for stat(2). The latter is treated incorrectly by some applications. For example, glibc pre-2.25 uses this value for stdio buffering which completely ruins performance with random reads.
The patch changes the behaviour of getattr rather than inode initialization so that change of the setting causes immediate effect without the need of reclaiming existing inodes.
The patch is similar to the patch from bz # 12739 by Aurelien Degremont.
WC-bug-id: https://jira.whamcloud.com/browse/LU-9413
Reviewed-on: https://review.whamcloud.com/26869
--- drivers/staging/lustre/lustre/llite/file.c | 2 +- .../staging/lustre/lustre/llite/llite_internal.h | 6 +++- drivers/staging/lustre/lustre/llite/lproc_llite.c | 33 ++++++++++++++++++++++ 3 files changed, 39 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/llite/file.c +1 -1
@@ -3267,7 +3267,7 @@ int ll_getattr(const struct path *path, struct kstat *stat, stat->atime = inode->i_atime; stat->mtime = inode->i_mtime; stat->ctime = inode->i_ctime; - stat->blksize =1 << inode->i_blkbits; + stat->blksize = sbi->ll_stat_blksize ?:BIT (inode->i_blkbits); stat->nlink = inode->i_nlink; stat->size =i_size_read (inode);
drivers/staging/lustre/lustre/llite/llite_internal.h +5 -1
@@ -523,7 +523,11 @@ struct ll_sb_info {struct root_squash_info ll_squash;struct path ll_mnt; -__kernel_fsid_t ll_fsid; +/* st_blksize returned by stat(2), when non-zero */ +unsigned int ll_stat_blksize; + +__kernel_fsid_t ll_fsid; +struct kset ll_kset;/* sysfs object */ struct completion ll_kobj_unregister; };
drivers/staging/lustre/lustre/llite/lproc_llite.c +33 -0
@@ -128,6 +128,38 @@ static ssize_t blocksize_show(struct kobject *kobj, struct attribute *attr, }LUSTRE_RO_ATTR (blocksize); +static ssize_t stat_blocksize_show (struct kobject *kobj,struct attribute *attr, +char *buf) +{ + struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info, + ll_kset.kobj); + +return sprintf (buf,"%u\n" , sbi->ll_stat_blksize); +} + +static ssize_t stat_blocksize_store (struct kobject *kobj, +struct attribute *attr, +const char *buffer, +size_t count) +{ + struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info, + ll_kset.kobj); +unsigned int val; +int rc; + + rc =kstrtouint (buffer,10 , &val); +if (rc) +return rc; + +if (val !=0 && (val <PAGE_SIZE || (val & (val -1 ))) !=0 ) +return -ERANGE ; + + sbi->ll_stat_blksize = val; + +return count; +} +LUSTRE_RW_ATTR (stat_blocksize); +static ssize_t kbytestotal_show (struct kobject *kobj,struct attribute *attr,char *buf) {
@@ -1123,6 +1155,7 @@ static ssize_t ll_nosquash_nids_seq_write(struct file *file,static struct attribute *llite_attrs[] = { &lustre_attr_blocksize.attr, + &lustre_attr_stat_blocksize.attr, &lustre_attr_kbytestotal.attr, &lustre_attr_kbytesfree.attr, &lustre_attr_kbytesavail.attr,
Signature · 1 line
1.8.3.1
PATCH 18/30 lustre: llite: llite.stat_blocksize param for fixed st_blksize
Quoted 33 lines · James Simmons
From: Andrew Perepechko <[email protected]>
llite.stat_blocksize is added to allow configurable
st_blksizefor stat(2). The latter is treated incorrectly by some applications. For example, glibc pre-2.25 uses this value for stdio buffering which completely ruins performance with random reads.The patch changes the behaviour of getattr rather than inode initialization so that change of the setting causes immediate effect without the need of reclaiming existing inodes.
The patch is similar to the patch from bz # 12739 by Aurelien Degremont.
Signed-off-by Andrew Perepechko <[email protected]>WC-bug-id: https://jira.whamcloud.com/browse/LU-9413
Reviewed-on: https://review.whamcloud.com/26869Reviewed-by Alexander Zarochentsev <[email protected]>Reviewed-by Andreas Dilger <[email protected]>Reviewed-by Oleg Drokin <[email protected]>Signed-off-by James Simmons <[email protected]>--- drivers/staging/lustre/lustre/llite/file.c | 2 +- .../staging/lustre/lustre/llite/llite_internal.h | 6 +++- drivers/staging/lustre/lustre/llite/lproc_llite.c | 33 ++++++++++++++++++++++ 3 files changed, 39 insertions(+), 2 deletions(-)drivers/staging/lustre/lustre/llite/file.c +0
-0
drivers/staging/lustre/lustre/llite/file.c int ll_getattr(const struct path *path, struct kstat *stat, · line 3270
Quoted 5 lines
drivers/staging/lustre/lustre/llite/file.c +1
-1@@ -3267,7 +3267,7 @@ int ll_getattr(const struct path *path, struct kstat *stat, stat->atime = inode->i_atime; stat->mtime = inode->i_mtime; stat->ctime = inode->i_ctime; - stat->blksize =1 << inode->i_blkbits; + stat->blksize = sbi->ll_stat_blksize ?:BIT (inode->i_blkbits);
I replaced the BIT() with (1<< ).
Thanks,
NeilBrown
Quoted 73 lines
drivers/staging/lustre/lustre/llite/file.c +0
-0stat->nlink = inode->i_nlink; stat->size =i_size_read (inode);drivers/staging/lustre/lustre/llite/llite_internal.h +5
-1@@ -523,7 +523,11 @@ struct ll_sb_info {struct root_squash_info ll_squash;struct path ll_mnt; -__kernel_fsid_t ll_fsid; +/* st_blksize returned by stat(2), when non-zero */ +unsigned int ll_stat_blksize; + +__kernel_fsid_t ll_fsid; +struct kset ll_kset;/* sysfs object */ struct completion ll_kobj_unregister; };drivers/staging/lustre/lustre/llite/lproc_llite.c +33
-0@@ -128,6 +128,38 @@ static ssize_t blocksize_show(struct kobject *kobj, struct attribute *attr, }LUSTRE_RO_ATTR (blocksize); +static ssize_t stat_blocksize_show (struct kobject *kobj,struct attribute *attr, +char *buf) +{ + struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info, + ll_kset.kobj); + +return sprintf (buf,"%u\n" , sbi->ll_stat_blksize); +} + +static ssize_t stat_blocksize_store (struct kobject *kobj, +struct attribute *attr, +const char *buffer, +size_t count) +{ + struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info, + ll_kset.kobj); +unsigned int val; +int rc; + + rc =kstrtouint (buffer,10 , &val); +if (rc) +return rc; + +if (val !=0 && (val <PAGE_SIZE || (val & (val -1 ))) !=0 ) +return -ERANGE ; + + sbi->ll_stat_blksize = val; + +return count; +} +LUSTRE_RW_ATTR (stat_blocksize); +static ssize_t kbytestotal_show (struct kobject *kobj,struct attribute *attr,char *buf) {@@ -1123,6 +1155,7 @@ static ssize_t ll_nosquash_nids_seq_write(struct file *file,static struct attribute *llite_attrs[] = { &lustre_attr_blocksize.attr, + &lustre_attr_stat_blocksize.attr, &lustre_attr_kbytestotal.attr, &lustre_attr_kbytesfree.attr, &lustre_attr_kbytesavail.attr,Signature · 1 line
1.8.3.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180924/af54ade6/attachment.sig>
PATCH 19/30 lustre: llite: set sec ctx on client's inode at create time
In reply to James SimmonsFrom: Sebastien Buisson <[email protected]>
On client side, security context must be set on the inode of every new dir or file that is being created.
With LL_SBI_FILE_SECCTX, security context is obtained from the dentry thanks to a call to ll_dentry_init_security(). And it is saved to security.xxx xattr directly on MDS side when processing the create request. So it is only necessary to call security_inode_notifysecctx() to set the sec ctx on the client's inode.
Without LL_SBI_FILE_SECCTX, security context can only be obtained from the inode, ie after the file has been created on MDS side. So use ll_inode_init_security() that will set the sec ctx on the client's inode, and at the same time save it on disk to security.xxx xattr, generating an additional request to the MDS.
WC-bug-id: https://jira.whamcloud.com/browse/LU-8956
Reviewed-on: https://review.whamcloud.com/24426
--- drivers/staging/lustre/lustre/llite/dir.c | 10 ++++- drivers/staging/lustre/lustre/llite/namei.c | 59 ++++++++++++++++++++++++----- 2 files changed, 59 insertions(+), 10 deletions(-)
drivers/staging/lustre/lustre/llite/dir.c +9 -1
@@ -42,6 +42,7 @@#include <linux/buffer_head.h> /* for wait_on_buffer */ #include <linux/pagevec.h> #include <linux/prefetch.h> +#include <linux/security.h> #define DEBUG_SUBSYSTEM S_LLITE
@@ -468,8 +469,15 @@ static int ll_dir_setdirstripe(struct dentry *dparent, struct lmv_user_md *lump, dentry.d_inode = inode; -if (!(sbi->ll_flags &LL_SBI_FILE_SECCTX )) +if (sbi->ll_flags &LL_SBI_FILE_SECCTX ) { +inode_lock (inode); + err =security_inode_notifysecctx (inode, + op_data->op_file_secctx, + op_data->op_file_secctx_size); +inode_unlock (inode); + }else { err =ll_inode_init_security (&dentry, inode, parent); + } out_inode:iput (inode);
drivers/staging/lustre/lustre/llite/namei.c +50 -9
138 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 20/30 lustre: osc: osc page lru list race
In reply to James SimmonsFrom: Bobi Jam <[email protected]>
In osc_lru_use() the osc page's ops_lru access is not protected, which could race with osc_lru_del() and ensuing that client_obd::cl_lru_in_list counter decreased twice for a single page.
WC-bug-id: https://jira.whamcloud.com/browse/LU-9229
Reviewed-on: https://review.whamcloud.com/26086
--- drivers/staging/lustre/lustre/osc/osc_page.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/staging/lustre/lustre/osc/osc_page.c +6 -4
@@ -478,18 +478,20 @@ static void osc_lru_del(struct client_obd *cli, struct osc_page *opg) }/** -* Delete page from LRUlist for redirty. +* Delete page from LRU list for redirty. */ static void osc_lru_use (struct client_obd *cli,struct osc_page *opg) {/* If page is being transferred for the first time, * ops_lru should be empty */ -if (opg->ops_in_lru && !list_empty (&opg->ops_lru)) { +if (opg->ops_in_lru) {spin_lock (&cli->cl_lru_list_lock); -__osc_lru_del (cli, opg); +if (!list_empty (&opg->ops_lru)) { +__osc_lru_del (cli, opg); +atomic_long_inc (&cli->cl_lru_busy); + }spin_unlock (&cli->cl_lru_list_lock); -atomic_long_inc (&cli->cl_lru_busy); } }
Signature · 1 line
1.8.3.1
PATCH 21/30 lustre: ldlm: use static initializer macros where possible
In reply to James SimmonsFrom: "John L. Hammond" <[email protected]>
In lustre/ldlm/ replace module load time initialization of several mutexes with static initialization using the kernel provided macros.
WC-bug-id: https://jira.whamcloud.com/browse/LU-9010
Reviewed-on: https://review.whamcloud.com/24824
--- drivers/staging/lustre/lustre/include/lustre_dlm.h | 3 +-- drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 6 +----- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 4 ++-- 3 files changed, 4 insertions(+), 9 deletions(-)
drivers/staging/lustre/lustre/include/lustre_dlm.h +1 -2
@@ -742,8 +742,7 @@ struct ldlm_lock {* The lists this could be linked into are: * waiting_locks_list (protected by waiting_locks_spinlock), * then if the lock timed out, it is moved to -* expired_lock_thread.elt_expired_locks for further processing. -* Protected by elt_lock. +* expired_lock_list for further processing. */ struct list_head l_pending_chain;
drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c +1 -5
@@ -53,7 +53,7 @@module_param (ldlm_cpts, charp,0444 );MODULE_PARM_DESC (ldlm_cpts,"CPU partitions ldlm threads should run on" ); -static struct mutex ldlm_ref_mutex; +static DEFINE_MUTEX (ldlm_ref_mutex);static int ldlm_refcount;static struct kobject *ldlm_kobj;
@@ -69,10 +69,6 @@ struct ldlm_cb_async_args {static struct ldlm_state *ldlm_state; -#define ELT_STOPPED 0 -#define ELT_READY 1 -#define ELT_TERMINATE 2 -struct ldlm_bl_pool {spinlock_t blp_lock;
drivers/staging/lustre/lustre/ldlm/ldlm_resource.c +2 -2
@@ -49,10 +49,10 @@int ldlm_srv_namespace_nr;int ldlm_cli_namespace_nr; -struct mutex ldlm_srv_namespace_lock; +DEFINE_MUTEX (ldlm_srv_namespace_lock);LIST_HEAD (ldlm_srv_namespace_list); -struct mutex ldlm_cli_namespace_lock; +DEFINE_MUTEX (ldlm_cli_namespace_lock);/* Client Namespaces that have active resources in them. * Once all resources go away, ldlm_poold moves such namespaces to the * inactive list
Signature · 1 line
1.8.3.1
PATCH 21/30 lustre: ldlm: use static initializer macros where possible
Quoted 46 lines · James Simmons
From: "John L. Hammond" <[email protected]>
In lustre/ldlm/ replace module load time initialization of several mutexes with static initialization using the kernel provided macros.
Signed-off-by John L. Hammond <[email protected]>WC-bug-id: https://jira.whamcloud.com/browse/LU-9010
Reviewed-on: https://review.whamcloud.com/24824Reviewed-by Dmitry Eremin <[email protected]>Reviewed-by James Simmons <[email protected]>Reviewed-by Andreas Dilger <[email protected]>Signed-off-by James Simmons <[email protected]>--- drivers/staging/lustre/lustre/include/lustre_dlm.h | 3 +-- drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 6 +----- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 4 ++-- 3 files changed, 4 insertions(+), 9 deletions(-)drivers/staging/lustre/lustre/include/lustre_dlm.h +1
-2@@ -742,8 +742,7 @@ struct ldlm_lock {* The lists this could be linked into are: * waiting_locks_list (protected by waiting_locks_spinlock), * then if the lock timed out, it is moved to -* expired_lock_thread.elt_expired_locks for further processing. -* Protected by elt_lock. +* expired_lock_list for further processing. */ struct list_head l_pending_chain;drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c +1
-1@@ -53,7 +53,7 @@module_param (ldlm_cpts, charp,0444 );MODULE_PARM_DESC (ldlm_cpts,"CPU partitions ldlm threads should run on" ); -static struct mutex ldlm_ref_mutex; +static DEFINE_MUTEX (ldlm_ref_mutex);static int ldlm_refcount;static struct kobject *ldlm_kobj;
drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c struct ldlm_cb_async_args { · line 75
Quoted 7 lines
drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c +0
-4@@ -69,10 +69,6 @@ struct ldlm_cb_async_args {static struct ldlm_state *ldlm_state; -#define ELT_STOPPED 0 -#define ELT_READY 1 -#define ELT_TERMINATE 2 -
Arg... Why do people do this???
One patch - one change.
This change is irrelevant to this patch, so it just makes it harder to review.
Grumble.
NeilBrown
Quoted 22 lines
drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c +0
-0struct ldlm_bl_pool {spinlock_t blp_lock;drivers/staging/lustre/lustre/ldlm/ldlm_resource.c +2
-2@@ -49,10 +49,10 @@int ldlm_srv_namespace_nr;int ldlm_cli_namespace_nr; -struct mutex ldlm_srv_namespace_lock; +DEFINE_MUTEX (ldlm_srv_namespace_lock);LIST_HEAD (ldlm_srv_namespace_list); -struct mutex ldlm_cli_namespace_lock; +DEFINE_MUTEX (ldlm_cli_namespace_lock);/* Client Namespaces that have active resources in them. * Once all resources go away, ldlm_poold moves such namespaces to the * inactive list Signature · 1 line
1.8.3.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180924/1956aaa2/attachment.sig>
PATCH 22/30 lustre: osc: update timestamps on write only
In reply to James SimmonsFrom: Niu Yawei <[email protected]>
In osc_io_submit(), we should only update timestamps on write.
WC-bug-id: https://jira.whamcloud.com/browse/LU-9470
Reviewed-on: https://review.whamcloud.com/27348
--- drivers/staging/lustre/lustre/osc/osc_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/osc/osc_io.c +1 -1
@@ -212,7 +212,7 @@ static int osc_io_submit(const struct lu_env *env, result =osc_queue_sync_pages (env, osc, &list, cmd, brw_flags);/* Update c/mtime for sync write. LU-7310 */ -if (qout->pl_nr >0 && !result) { +if (crt ==CRT_WRITE && qout->pl_nr >0 && !result) {struct cl_attr *attr = &osc_env_info (env)->oti_attr;struct cl_object *obj = ios->cis_obj;
Signature · 1 line
1.8.3.1
PATCH 23/30 lustre: osc: adds radix_tree_preload
In reply to James SimmonsFrom: Alexandr Boyko <[email protected]>
The client fail with next error osc_page_init()) ASSERTION( result == 0 ) in low memory conditions.
The patch fixes the problem above by adding radix_tree_preload.
WC-bug-id: https://jira.whamcloud.com/browse/LU-9579
Seagate-bug-id: MRP-4424
Reviewed-on: https://review.whamcloud.com/27372
--- drivers/staging/lustre/lustre/osc/osc_page.c | 33 ++++++++++++++++------------ 1 file changed, 19 insertions(+), 14 deletions(-)
drivers/staging/lustre/lustre/osc/osc_page.c +19 -14
@@ -256,32 +256,37 @@ int osc_page_init(const struct lu_env *env, struct cl_object *obj, {struct osc_object *osc =cl2osc (obj);struct osc_page *opg =cl_object_page_slice (obj, page); +struct osc_io *oio =osc_env_io (env);int result; opg->ops_from =0 ; opg->ops_to =PAGE_SIZE ; +INIT_LIST_HEAD (&opg->ops_lru); result =osc_prep_async_page (osc, opg, page->cp_vmpage,cl_offset (obj, index)); -if (result ==0 ) { -struct osc_io *oio =osc_env_io (env); +if (result !=0 ) +return result; - opg->ops_srvlock =osc_io_srvlock (oio); -cl_page_slice_add (page, &opg->ops_cl, obj, index, - &osc_page_ops); - } -INIT_LIST_HEAD (&opg->ops_lru); + opg->ops_srvlock =osc_io_srvlock (oio); +cl_page_slice_add (page, &opg->ops_cl, obj, index, + &osc_page_ops);/* reserve an LRU space for this page */ -if (page->cp_type ==CPT_CACHEABLE && result ==0 ) { +if (page->cp_type ==CPT_CACHEABLE ) { result =osc_lru_alloc (env,osc_cli (osc), opg);if (result ==0 ) { -spin_lock (&osc->oo_tree_lock); - result =radix_tree_insert (&osc->oo_tree, index, opg); -if (result ==0 ) - ++osc->oo_npages; -spin_unlock (&osc->oo_tree_lock); -LASSERT (result ==0 ); + result =radix_tree_preload (GFP_KERNEL ); +if (result ==0 ) { +spin_lock (&osc->oo_tree_lock); + result =radix_tree_insert (&osc->oo_tree, + index, opg); +if (result ==0 ) + ++osc->oo_npages; +spin_unlock (&osc->oo_tree_lock); + +radix_tree_preload_end (); + } } }
Signature · 1 line
1.8.3.1
PATCH 24/30 lustre: llite: rcu-walk check should not depend on statahead
In reply to James SimmonsFrom: Steve Guminski <[email protected]>
Moves the check for the LOOKUP_RCU flag, so that it does not depend on the statahead setting. The caller is now informed if rcu-walk was requested but the filesystem does not support it, regardless of whether statahead is enabled or disabled.
WC-bug-id: https://jira.whamcloud.com/browse/LU-8891
Reviewed-on: https://review.whamcloud.com/24195
--- drivers/staging/lustre/lustre/llite/dcache.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/staging/lustre/lustre/llite/dcache.c +3 -4
@@ -270,13 +270,12 @@ static int ll_revalidate_dentry(struct dentry *dentry,if (lookup_flags &LOOKUP_REVAL )return 0 ; -if (!dentry_may_statahead (dir, dentry)) -return 1 ; -if (lookup_flags &LOOKUP_RCU )return -ECHILD ; -ll_statahead (dir, &dentry, !d_inode (dentry)); +if (dentry_may_statahead (dir, dentry)) +ll_statahead (dir, &dentry, !d_inode (dentry)); +return 1 ; }
Signature · 1 line
1.8.3.1
PATCH 24/30 lustre: llite: rcu-walk check should not depend on statahead
Quoted 6 lines · James Simmons
From: Steve Guminski <[email protected]>
Moves the check for the
LOOKUP_RCUflag, so that it does not depend on the statahead setting. The caller is now informed if rcu-walk was requested but the filesystem does not support it, regardless of whether statahead is enabled or disabled.
Nope, this is wrong.
The filesystem only returns -ECHILD if it couldn't complete the request because it would have to block.
If statahead is disabled, then it can complete the request immediately, doesn't need to block, and so doesn't need to return -ECHILD.
Patch deleted.
Thanks,
NeilBrown
Quoted 35 lines
Signed-off-by Steve Guminski <[email protected]>WC-bug-id: https://jira.whamcloud.com/browse/LU-8891
Reviewed-on: https://review.whamcloud.com/24195Reviewed-by John L. Hammond <[email protected]>Reviewed-by Andreas Dilger <[email protected]>Reviewed-by Oleg Drokin <[email protected]>Signed-off-by James Simmons <[email protected]>--- drivers/staging/lustre/lustre/llite/dcache.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)drivers/staging/lustre/lustre/llite/dcache.c +3
-4@@ -270,13 +270,12 @@ static int ll_revalidate_dentry(struct dentry *dentry,if (lookup_flags &LOOKUP_REVAL )return 0 ; -if (!dentry_may_statahead (dir, dentry)) -return 1 ; -if (lookup_flags &LOOKUP_RCU )return -ECHILD ; -ll_statahead (dir, &dentry, !d_inode (dentry)); +if (dentry_may_statahead (dir, dentry)) +ll_statahead (dir, &dentry, !d_inode (dentry)); +return 1 ; }Signature · 1 line
1.8.3.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180924/eeef3d51/attachment.sig>
PATCH 24/30 lustre: llite: rcu-walk check should not depend on statahead
Quoted 10 lines · James Simmons
Quoted 7 lines
From: Steve Guminski <[email protected]>
Moves the check for the
LOOKUP_RCUflag, so that it does not depend on the statahead setting. The caller is now informed if rcu-walk was requested but the filesystem does not support it, regardless of whether statahead is enabled or disabled.
Quoted 8 lines
Nope, this is wrong.
The filesystem only returns
-ECHILDif it couldn't complete the request because it would have to block.
If statahead is disabled, then it can complete the request immediately, doesn't need to block, and so doesn't need to return-ECHILD.Patch deleted.
Do this patch need to be reverted in the OpenSFS branch or can it be ignored?
Quoted 35 lines
Quoted 34 lines
Signed-off-by Steve Guminski <[email protected]>WC-bug-id: https://jira.whamcloud.com/browse/LU-8891
Reviewed-on: https://review.whamcloud.com/24195Reviewed-by John L. Hammond <[email protected]>Reviewed-by Andreas Dilger <[email protected]>Reviewed-by Oleg Drokin <[email protected]>Signed-off-by James Simmons <[email protected]>--- drivers/staging/lustre/lustre/llite/dcache.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)drivers/staging/lustre/lustre/llite/dcache.c +3
-4@@ -270,13 +270,12 @@ static int ll_revalidate_dentry(struct dentry *dentry,if (lookup_flags &LOOKUP_REVAL )return 0 ; -if (!dentry_may_statahead (dir, dentry)) -return 1 ; -if (lookup_flags &LOOKUP_RCU )return -ECHILD ; -ll_statahead (dir, &dentry, !d_inode (dentry)); +if (dentry_may_statahead (dir, dentry)) +ll_statahead (dir, &dentry, !d_inode (dentry)); +return 1 ; }Signature · 1 line
1.8.3.1
PATCH 24/30 lustre: llite: rcu-walk check should not depend on statahead
Quoted 16 lines · James Simmons
Quoted 16 lines · James Simmons
Quoted 7 lines
From: Steve Guminski <[email protected]>
Moves the check for the
LOOKUP_RCUflag, so that it does not depend on the statahead setting. The caller is now informed if rcu-walk was requested but the filesystem does not support it, regardless of whether statahead is enabled or disabled.Nope, this is wrong.
The filesystem only returns
-ECHILDif it couldn't complete the request because it would have to block.
If statahead is disabled, then it can complete the request immediately, doesn't need to block, and so doesn't need to return-ECHILD.
Quoted 4 lines
Quoted 1 line
Patch deleted.
Do this patch need to be reverted in the OpenSFS branch or can it be ignored?
It can be ignored.
The justification for the patch (and it is definitely nice to see a clearly stated justification!!) was based on a misunderstanding, and as wrong.
The code itself introduces a small performance hit when statahead is not being used. I can't really say if it would be noticeable or not, but you could only notice it on a many CPU machine where lots of the filesystem was cached locally, and there was no need to go to the server to service lots of lookups.
NeilBrown
Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
Signed-off-by Steve Guminski <[email protected]>WC-bug-id: https://jira.whamcloud.com/browse/LU-8891
Reviewed-on: https://review.whamcloud.com/24195Reviewed-by John L. Hammond <[email protected]>Reviewed-by Andreas Dilger <[email protected]>Reviewed-by Oleg Drokin <[email protected]>Signed-off-by James Simmons <[email protected]>--- drivers/staging/lustre/lustre/llite/dcache.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)drivers/staging/lustre/lustre/llite/dcache.c +3
-4@@ -270,13 +270,12 @@ static int ll_revalidate_dentry(struct dentry *dentry,if (lookup_flags &LOOKUP_REVAL )return 0 ; -if (!dentry_may_statahead (dir, dentry)) -return 1 ; -if (lookup_flags &LOOKUP_RCU )return -ECHILD ; -ll_statahead (dir, &dentry, !d_inode (dentry)); +if (dentry_may_statahead (dir, dentry)) +ll_statahead (dir, &dentry, !d_inode (dentry)); +return 1 ; }
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
Signature · 1 line
1.8.3.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20181002/cf2a0e2e/attachment.sig>
PATCH 25/30 lustre: llite: check the return value of cl_file_inode_init()
In reply to James SimmonsFrom: Bobi Jam <[email protected]>
ll_update_inode() does not check the return value of cl_file_inode_init(), and it should check.
WC-bug-id: https://jira.whamcloud.com/browse/LU-9485
Reviewed-on: https://review.whamcloud.com/27658
--- drivers/staging/lustre/lustre/llite/llite_lib.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/staging/lustre/lustre/llite/llite_lib.c +6 -4
@@ -1792,13 +1792,15 @@ int ll_update_inode(struct inode *inode, struct lustre_md *md)struct ll_inode_info *lli =ll_i2info (inode);struct mdt_body *body = md->body;struct ll_sb_info *sbi =ll_i2sbi (inode); +int rc =0 ; -if (body->mbo_valid &OBD_MD_FLEASIZE ) -cl_file_inode_init (inode, md); +if (body->mbo_valid &OBD_MD_FLEASIZE ) { + rc =cl_file_inode_init (inode, md); +if (rc) +return rc; + }if (S_ISDIR (inode->i_mode)) { -int rc; - rc =ll_update_lsm_md (inode, md);if (rc)return rc;
Signature · 1 line
1.8.3.1
PATCH 26/30 lustre: ptlrpc: add replay request into unreplied list
In reply to James SimmonsFrom: Niu Yawei <[email protected]>
ptlrpc_prepare_replay() may fail to add replay request into unreplied list if the request hasn't been on replay list yet, so in ptlrpc_replay_next() before sending replay, we'd always make sure the replay request is on unreplied list.
WC-bug-id: https://jira.whamcloud.com/browse/LU-9274
Reviewed-on: https://review.whamcloud.com/27920
--- drivers/staging/lustre/lustre/ptlrpc/recover.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/lustre/lustre/ptlrpc/recover.c +6 -6
@@ -136,11 +136,14 @@ int ptlrpc_replay_next(struct obd_import *imp, int *inflight)if (req && imp->imp_resend_replay)lustre_msg_add_flags (req->rq_reqmsg,MSG_RESENT ); -/* The resend replay request may have been removed from the +/* ptlrpc_prepare_replay() may fail to add the request into unreplied +* list if the request hasn't been added to replay list then. Another +* exception is that resend replay could have been removed from the * unreplied list. */ -if (req && imp->imp_resend_replay && -list_empty (&req->rq_unreplied_list)) { +if (req &&list_empty (&req->rq_unreplied_list)) { +DEBUG_REQ (D_HA , req,"resend_replay: %d, last_transno: %llu\n" , + imp->imp_resend_replay, last_transno);ptlrpc_add_unreplied (req); imp->imp_known_replied_xid =ptlrpc_known_replied_xid (imp); }
@@ -149,9 +152,6 @@ int ptlrpc_replay_next(struct obd_import *imp, int *inflight)spin_unlock (&imp->imp_lock);if (req) { -/* The request should have been added back in unreplied list -* by ptlrpc_prepare_replay(). -*/ LASSERT (!list_empty (&req->rq_unreplied_list)); rc =ptlrpc_replay_req (req);
Signature · 1 line
1.8.3.1
PATCH 27/30 lustre: ptlrpc: increase sleep time in ptlrpc_request_bufs_pack()
In reply to James SimmonsFrom: Vitaly Fertman <[email protected]>
schedule_timeout_uninterruptible() does not necessarily expire. Increase the sleeping time in ptlrpc_request_bufs_pack() as 2 seconds is too short, given the 1 second sleep used in the test suite.
WC-bug-id: https://jira.whamcloud.com/browse/LU-8062
Reviewed-on: https://review.whamcloud.com/26815
--- drivers/staging/lustre/lustre/ptlrpc/client.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/lustre/lustre/ptlrpc/client.c +3 -1
@@ -36,7 +36,9 @@#define DEBUG_SUBSYSTEM S_RPC#include <linux/libcfs/libcfs_cpu.h> +#include <linux/delay.h> #include <linux/random.h> +#include <obd_support.h> #include <obd_class.h> #include <lustre_lib.h>
@@ -763,7 +765,7 @@ int ptlrpc_request_bufs_pack(struct ptlrpc_request *request,/* The RPC is infected, let the test change the * fail_loc */ -schedule_timeout_uninterruptible (2 *HZ ); +msleep (4 *MSEC_PER_SEC ); } }
Signature · 1 line
1.8.3.1
PATCH 28/30 lustre: ptlrpc: free reply buffer earlier for open RPC
In reply to James SimmonsFrom: Fan Yong <[email protected]>
It is unnecessary to keep the reply buffer for open RPC. Replay related data has already been saved in the request buffer when the RPC replied. If the open replay really happen, the replay logic will alloc the reply buffer when needed.
On the other hand, the client always tries to alloc big enough space to hold the open RPC reply since the client does not exactly know how much data the server will reply to the client. So the reply buffer may be quite larger than the real needed. Under such case, keeping the large reply buffer for the open RPC will occupy a lot of RAM as to OOM if the are too many open RPCs to be replayed.
This patch frees the reply buffer for the open RPC when only the replay logic holds the last reference of the RPC.
WC-bug-id: https://jira.whamcloud.com/browse/LU-9514
Reviewed-on: https://review.whamcloud.com/27208
--- drivers/staging/lustre/lustre/include/lustre_net.h | 6 ++- drivers/staging/lustre/lustre/mdc/mdc_request.c | 20 ++++++++- drivers/staging/lustre/lustre/ptlrpc/client.c | 49 +++++++++++++++++----- .../staging/lustre/lustre/ptlrpc/pack_generic.c | 26 ++++++++---- .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 1 + 5 files changed, 80 insertions(+), 22 deletions(-)
drivers/staging/lustre/lustre/include/lustre_net.h +4 -2
@@ -738,7 +738,8 @@ struct ptlrpc_request {/** Lock to protect request flags and some other important bits, like * rq_list */ -spinlock_t rq_lock; +spinlock_t rq_lock; +spinlock_t rq_early_free_lock;/** client-side flags are serialized by rq_lock @{ */ unsigned int rq_intr:1, rq_replied:1, rq_err:1, rq_timedout:1, rq_resend:1, rq_restart:1,
@@ -770,7 +771,8 @@ struct ptlrpc_request {*/ rq_allow_replay:1, /* bulk request, sent to server, but uncommitted */ - rq_unstable:1; + rq_unstable:1, + rq_early_free_repbuf:1; /* free reply buffer in advance *//** @} */ /** server-side flags @{ */
drivers/staging/lustre/lustre/mdc/mdc_request.c +18 -2
@@ -573,8 +573,15 @@ void mdc_replay_open(struct ptlrpc_request *req) body =req_capsule_server_get (&req->rq_pill, &RMF_MDT_BODY ); +spin_lock (&req->rq_lock); och = mod->mod_och; -if (och) { +if (och && och->och_fh.cookie) + req->rq_early_free_repbuf =1 ; +else + req->rq_early_free_repbuf =0 ; +spin_unlock (&req->rq_lock); + +if (req->rq_early_free_repbuf) {struct lustre_handle *file_fh;LASSERT (och->och_magic ==OBD_CLIENT_HANDLE_MAGIC );
@@ -585,6 +592,7 @@ void mdc_replay_open(struct ptlrpc_request *req) old = *file_fh; *file_fh = body->mbo_handle; } + close_req = mod->mod_close_req;if (close_req) {__u32 opc =lustre_msg_get_opc (close_req->rq_reqmsg);
@@ -595,8 +603,9 @@ void mdc_replay_open(struct ptlrpc_request *req) &RMF_MDT_EPOCH);LASSERT (epoch); -if (och) +if (req->rq_early_free_repbuf)LASSERT (!memcmp (&old, &epoch->mio_handle,sizeof (old))); +DEBUG_REQ (D_HA , close_req,"updating close body with new fh" ); epoch->mio_handle = body->mbo_handle; }
@@ -677,6 +686,7 @@ int mdc_set_open_replay_data(struct obd_export *exp, mod->mod_open_req = open_req; open_req->rq_cb_data = mod; open_req->rq_commit_cb = mdc_commit_open; + open_req->rq_early_free_repbuf =1 ;spin_unlock (&open_req->rq_lock); }
@@ -731,6 +741,12 @@ static int mdc_clear_open_replay_data(struct obd_export *exp,LASSERT (mod !=LP_POISON );LASSERT (mod->mod_open_req); + +spin_lock (&mod->mod_open_req->rq_lock); +if (mod->mod_och) + mod->mod_och->och_fh.cookie =0 ; + mod->mod_open_req->rq_early_free_repbuf =0 ; +spin_unlock (&mod->mod_open_req->rq_lock);mdc_free_open (mod); mod->mod_och =NULL ;
drivers/staging/lustre/lustre/ptlrpc/client.c +39 -10
73 lines not on this page · raw message
drivers/staging/lustre/lustre/ptlrpc/pack_generic.c +18 -8
@@ -2169,7 +2169,8 @@ static inline int req_ptlrpc_body_swabbed(struct ptlrpc_request *req)static inline int rep_ptlrpc_body_swabbed (struct ptlrpc_request *req) { -LASSERT (req->rq_repmsg); +if (unlikely (!req->rq_repmsg)) +return 0 ;switch (req->rq_repmsg->lm_magic) {case LUSTRE_MSG_MAGIC_V2 :
@@ -2181,19 +2182,30 @@ static inline int rep_ptlrpc_body_swabbed(struct ptlrpc_request *req) }void _debug_req (struct ptlrpc_request *req, -struct libcfs_debug_msg_data *msgdata, -const char *fmt, ...) +struct libcfs_debug_msg_data *msgdata,const char *fmt, ...) { -int req_ok = req->rq_reqmsg !=NULL ; -int rep_ok = req->rq_repmsg !=NULL ; +bool req_ok = req->rq_reqmsg !=NULL ; +bool rep_ok = false;lnet_nid_t nid =LNET_NID_ANY ; +int rep_flags =-1 ; +int rep_status =-1 ;va_list args; +spin_lock (&req->rq_early_free_lock); +if (req->rq_repmsg) + rep_ok = true; +if (ptlrpc_req_need_swab (req)) { req_ok = req_ok &&req_ptlrpc_body_swabbed (req); rep_ok = rep_ok &&rep_ptlrpc_body_swabbed (req); } +if (rep_ok) { + rep_flags =lustre_msg_get_flags (req->rq_repmsg); + rep_status =lustre_msg_get_status (req->rq_repmsg); + } +spin_unlock (&req->rq_early_free_lock); +if (req->rq_import && req->rq_import->imp_connection) nid = req->rq_import->imp_connection->c_peer.nid;else if (req->rq_export && req->rq_export->exp_connection)
@@ -2218,9 +2230,7 @@ void _debug_req(struct ptlrpc_request *req,atomic_read (&req->rq_refcount),DEBUG_REQ_FLAGS (req), req_ok ?lustre_msg_get_flags (req->rq_reqmsg) :-1 , - rep_ok ?lustre_msg_get_flags (req->rq_repmsg) :-1 , - req->rq_status, - rep_ok ? lustre_msg_get_status(req->rq_repmsg) : -1); + rep_flags, req->rq_status, rep_status);va_end (args); }EXPORT_SYMBOL (_debug_req);
drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h +1 -0
@@ -309,6 +309,7 @@ static inline void ptlrpc_reqset_put(struct ptlrpc_request_set *set)static inline void ptlrpc_req_comm_init (struct ptlrpc_request *req) {spin_lock_init (&req->rq_lock); +spin_lock_init (&req->rq_early_free_lock);atomic_set (&req->rq_refcount,1 );INIT_LIST_HEAD (&req->rq_list);INIT_LIST_HEAD (&req->rq_replay_list);
Signature · 1 line
1.8.3.1
PATCH 29/30 lustre: libcfs: use save_stack_trace for stack dump
In reply to James SimmonsFrom: Yang Sheng <[email protected]>
The function libcfs_debug_dumpstack() was removed due to it being x86 specific upstream. This restores this functionality using save_stack_trace_tsk for stack trace dumps. This will be used for the restored ptlrpc watchdog that will be landed in the future.
WC-bug-id: https://jira.whamcloud.com/browse/LU-11062
Reviewed-on: https://review.whamcloud.com/32952
--- .../lustre/include/linux/libcfs/libcfs_debug.h | 1 + drivers/staging/lustre/lnet/libcfs/debug.c | 46 ++++++++++++++++++++-- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 2 +- drivers/staging/lustre/lustre/osc/osc_object.c | 2 +- 4 files changed, 46 insertions(+), 5 deletions(-)
drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h +1 -0
@@ -58,6 +58,7 @@int libcfs_debug_mask2str (char *str,int size,int mask,int is_subsys);int libcfs_debug_str2mask (int *mask,const char *str,int is_subsys); +void libcfs_debug_dumpstack (struct task_struct *tsk);/* Has there been an LBUG? */ extern unsigned int libcfs_catastrophe;
drivers/staging/lustre/lnet/libcfs/debug.c +43 -3
66 lines not on this page · raw message
drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +1 -1
@@ -1503,7 +1503,7 @@ int ldlm_fill_lvb(struct ldlm_lock *lock, struct req_capsule *pill,break ;default :LDLM_ERROR (lock,"Unknown LVB type: %d" , lock->l_lvb_type); -dump_stack (); +libcfs_debug_dumpstack (NULL );return -EINVAL ; }
drivers/staging/lustre/lustre/osc/osc_object.c +1 -1
@@ -399,7 +399,7 @@ static void osc_req_attr_set(const struct lu_env *env, struct cl_object *obj,osc_export (cl2osc (obj))->exp_obd->obd_namespace, NULL, resname, LDLM_EXTENT, 0);ldlm_resource_dump (D_ERROR , res); - +libcfs_debug_dumpstack (NULL );LBUG (); }
Signature · 1 line
1.8.3.1
PATCH 30/30 lustre: clio: fix spare bit handling
In reply to James SimmonsExpanded testing of the earlier patch that changed lustre so not to use the spare bits in iattr.ia_valid exposed a bug with HSM. The bugs was that ll_setattr_raw() was ignoring the changes to ctime.
WC-bug-id: https://jira.whamcloud.com/browse/LU-10030
Reviewed-on: https://review.whamcloud.com/32825
--- drivers/staging/lustre/lustre/llite/llite_lib.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/staging/lustre/lustre/llite/llite_lib.c +5 -4
@@ -1529,7 +1529,8 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, }/* We mark all of the fields "set" so MDS/OST does not re-set them */ -if (attr->ia_valid &ATTR_CTIME ) { +if (!(xvalid &OP_ATTR_CTIME_SET ) && + attr->ia_valid &ATTR_CTIME ) { attr->ia_ctime =current_time (inode); xvalid |=OP_ATTR_CTIME_SET ; }
@@ -1584,9 +1585,9 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, goto out; } -if (attr->ia_valid & (ATTR_SIZE | -ATTR_ATIME |ATTR_ATIME_SET | -ATTR_MTIME |ATTR_MTIME_SET )) { +if (attr->ia_valid & (ATTR_SIZE |ATTR_ATIME |ATTR_ATIME_SET | +ATTR_MTIME |ATTR_MTIME_SET |ATTR_CTIME ) || + xvalid &OP_ATTR_CTIME_SET ) {/* For truncate and utimes sending attributes to OSTs, setting * mtime/atime to the past will be performed under PW [0:EOF] * extent lock (new_size:EOF for truncate). It may seem
Signature · 1 line
1.8.3.1