lustre: update to OpenSFS tree Sept 5, 2022
Subsystems (2)
cover lustre: update to OpenSFS tree Sept 5, 2022
Port the patches from the OpenSFS tree to the Linux native client as of Sept 5, 2022. The crush2 patch is still held back and we integrated the fscrypt changes to give a big performance boost to Lustre.
Alexey Lyashkov (1):
lnet: selftest: use preallocate bulk for server
Andreas Dilger (2):
lustre: obdclass: use consistent stats units
lustre: idl: add checks for OBD_CONNECT flags
Bobi Jam (1):
lustre: ldlm: rid of obsolete param of ldlm_resource_get()
Chris Horn (3):
lnet: LNet peer aliveness broken
lnet: Correct net selection for router ping
lnet: Remove duplicate checks for peer sensitivity
Frank Sehr (1):
lnet: Memory leak on adding existing interface
Ian Ziemba (1):
lnet: o2iblnd: Salt comp_vector
Lai Siyao (1):
lustre: lmv: always space-balance r-r directories
Mr NeilBrown (1):
lnet: change ni_status in lnet_ni to u32*
Oleg Drokin (1):
lustre: update version to 2.15.51
Patrick Farrell (3):
lustre: llite: Rework upper/lower DIO/AIO
lustre: llite: Unify range unlock
lustre: llite: Refactor DIO/AIO free code
Qian Yingjin (4):
lustre: llite: fully disable readahead in kernel I/O path
lustre: llite: use fatal_signal_pending in range_lock
lustre: llite: simplify callback handling for async getattr
lustre: statahead: add total hit/miss count stats
Sebastien Buisson (4):
lustre: sec: new connect flag for name encryption
lustre: sec: use enc pool for bounce pages
lustre: sec: fix detection of SELinux enforcement
lustre: llite: fix stat attributes_mask
Serguei Smirnov (1):
lnet: Use fatal NI if none other available
fs/crypto/crypto.c | 34 +-- fs/lustre/include/cl_object.h | 40 ++- fs/lustre/include/lprocfs_status.h | 27 +- fs/lustre/include/lustre_crypto.h | 2 + fs/lustre/include/lustre_dlm.h | 1 - fs/lustre/include/lustre_intent.h | 2 + fs/lustre/include/lustre_sec.h | 3 + fs/lustre/include/obd.h | 27 +- fs/lustre/include/obd_class.h | 4 +- fs/lustre/ldlm/ldlm_lock.c | 6 +- fs/lustre/ldlm/ldlm_pool.c | 34 ++- fs/lustre/ldlm/ldlm_request.c | 4 +- fs/lustre/ldlm/ldlm_resource.c | 9 +- fs/lustre/llite/crypto.c | 19 +- fs/lustre/llite/dir.c | 8 +- fs/lustre/llite/file.c | 62 +++-- fs/lustre/llite/llite_internal.h | 52 +++- fs/lustre/llite/llite_lib.c | 25 +- fs/lustre/llite/lproc_llite.c | 57 +++-- fs/lustre/llite/namei.c | 8 +- fs/lustre/llite/rw26.c | 86 ++++--- fs/lustre/llite/statahead.c | 385 ++++++++++++++-------------- fs/lustre/llite/symlink.c | 2 +- fs/lustre/llite/xattr_cache.c | 8 +- fs/lustre/llite/xattr_security.c | 12 +- fs/lustre/lmv/lmv_obd.c | 44 ++-- fs/lustre/mdc/mdc_dev.c | 5 +- fs/lustre/mdc/mdc_internal.h | 3 +- fs/lustre/mdc/mdc_locks.c | 32 +-- fs/lustre/mdc/mdc_reint.c | 2 +- fs/lustre/obdclass/cl_internal.h | 1 + fs/lustre/obdclass/cl_io.c | 136 ++++++---- fs/lustre/obdclass/cl_object.c | 6 + fs/lustre/obdclass/lprocfs_status.c | 244 ++++++++++-------- fs/lustre/obdclass/lu_object.c | 17 +- fs/lustre/obdclass/range_lock.c | 2 +- fs/lustre/osc/osc_object.c | 6 +- fs/lustre/osc/osc_request.c | 136 +++++++++- fs/lustre/ptlrpc/lproc_ptlrpc.c | 32 +-- fs/lustre/ptlrpc/sec_bulk.c | 452 +++++++++++++++++++++++++++++++-- fs/lustre/ptlrpc/wiretest.c | 2 + include/linux/fscrypt.h | 49 +++- include/linux/lnet/lib-lnet.h | 52 +++- include/linux/lnet/lib-types.h | 2 +- include/uapi/linux/lustre/lustre_idl.h | 290 ++++++++++----------- include/uapi/linux/lustre/lustre_ver.h | 4 +- net/lnet/klnds/o2iblnd/o2iblnd.c | 14 +- net/lnet/klnds/o2iblnd/o2iblnd.h | 2 + net/lnet/lnet/api-ni.c | 19 +- net/lnet/lnet/lib-move.c | 98 +++---- net/lnet/lnet/lib-msg.c | 37 +-- net/lnet/lnet/router.c | 11 +- net/lnet/selftest/brw_test.c | 67 +++-- net/lnet/selftest/framework.c | 18 +- net/lnet/selftest/rpc.c | 51 ++-- net/lnet/selftest/selftest.h | 15 +- 56 files changed, 1806 insertions(+), 960 deletions(-)
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 1/24 lustre: sec: new connect flag for name encryption
From: Sebastien Buisson <[email protected]>
Introduce OBD_CONNECT2_ENCRYPT_NAME connection flag for compatibility with older versions that do not support name encryption. When server side does not have this flag, client side is forced to null encryption for file names. And client needs to use old xattr to store encryption context.
WC-bug-id: https://jira.whamcloud.com/browse/LU-15922
Lustre-commit: 71d63602c57e6d0cb ("LU-15922 sec: new connect flag for name encryption")
Reviewed-on: https://review.whamcloud.com/47574
--- fs/lustre/include/lustre_crypto.h | 2 ++ fs/lustre/llite/crypto.c | 19 ++++++++++++++++--- fs/lustre/llite/llite_internal.h | 30 +++++++++++++++++++++++++++--- fs/lustre/llite/llite_lib.c | 14 +++++++++++++- fs/lustre/llite/namei.c | 2 +- fs/lustre/llite/statahead.c | 2 +- fs/lustre/llite/symlink.c | 2 +- fs/lustre/llite/xattr_cache.c | 8 ++++---- fs/lustre/obdclass/lprocfs_status.c | 1 + fs/lustre/ptlrpc/wiretest.c | 2 ++ include/uapi/linux/lustre/lustre_idl.h | 1 + 11 files changed, 69 insertions(+), 14 deletions(-)
fs/lustre/include/lustre_crypto.h +2 -0
@@ -44,6 +44,8 @@ int ll_set_encflags(struct inode *inode, void *encctx, u32 encctxlen,bool ll_sb_has_test_dummy_encryption (struct super_block *sb);bool ll_sbi_has_encrypt (struct ll_sb_info *sbi);void ll_sbi_set_encrypt (struct ll_sb_info *sbi,bool set); +bool ll_sbi_has_name_encrypt (struct ll_sb_info *sbi); +void ll_sbi_set_name_encrypt (struct ll_sb_info *sbi,bool set);#else static inline int ll_set_encflags (struct inode *inode,void *encctx,u32 encctxlen,bool preload)
fs/lustre/llite/crypto.c +16 -3
@@ -36,7 +36,7 @@ static int ll_get_context(struct inode *inode, void *ctx, size_t len)/* Get enc context xattr directly instead of going through the VFS, * as there is no xattr handler for "encryption.". */ - rc =ll_xattr_list (inode,LL_XATTR_NAME_ENCRYPTION_CONTEXT , + rc =ll_xattr_list (inode,xattr_for_enc (inode),XATTR_ENCRYPTION_T , ctx, len,OBD_MD_FLXATTR );/* used as encryption unit size */
@@ -59,7 +59,7 @@ int ll_set_encflags(struct inode *inode, void *encctx, u32 encctxlen,if (encctx && encctxlen) rc =ll_xattr_cache_insert (inode, -LL_XATTR_NAME_ENCRYPTION_CONTEXT , +xattr_for_enc (inode), encctx, encctxlen);if (rc)return rc;
@@ -108,7 +108,7 @@ static int ll_set_context(struct inode *inode, const void *ctx, size_t len,* through the VFS, as there is no xattr handler for "encryption.". */ rc =md_setxattr (sbi->ll_md_exp,ll_inode2fid (inode), -OBD_MD_FLXATTR ,LL_XATTR_NAME_ENCRYPTION_CONTEXT , +OBD_MD_FLXATTR ,xattr_for_enc (inode), ctx, len,XATTR_CREATE ,ll_i2suppgid (inode), &req);if (rc)return rc;
@@ -173,6 +173,19 @@ void ll_sbi_set_encrypt(struct ll_sb_info *sbi, bool set) } } +bool ll_sbi_has_name_encrypt (struct ll_sb_info *sbi) +{ +return test_bit (LL_SBI_ENCRYPT_NAME , sbi->ll_flags); +} + +void ll_sbi_set_name_encrypt (struct ll_sb_info *sbi,bool set) +{ +if (set) +set_bit (LL_SBI_ENCRYPT_NAME , sbi->ll_flags); +else +clear_bit (LL_SBI_ENCRYPT_NAME , sbi->ll_flags); +} +static bool ll_empty_dir (struct inode *inode) {/* used by fscrypt_ioctl_set_policy(), because a policy can only be set
fs/lustre/llite/llite_internal.h +27 -3
@@ -468,11 +468,28 @@ static inline bool obd_connect_has_enc(struct obd_connect_data *data)static inline void obd_connect_set_enc (struct obd_connect_data *data) { -#ifdef HAVE_LUSTRE_CRYPTO +#ifdef CONFIG_FS_ENCRYPTION data->ocd_connect_flags2 |=OBD_CONNECT2_ENCRYPT ;#endif } +static inline bool obd_connect_has_name_enc (struct obd_connect_data *data) +{ +#ifdef CONFIG_FS_ENCRYPTION +return data->ocd_connect_flags &OBD_CONNECT_FLAGS2 && + data->ocd_connect_flags2 &OBD_CONNECT2_ENCRYPT_NAME ; +#else +return false; +#endif +} + +static inline void obd_connect_set_name_enc (struct obd_connect_data *data) +{ +#ifdef CONFIG_FS_ENCRYPTION + data->ocd_connect_flags2 |=OBD_CONNECT2_ENCRYPT_NAME ; +#endif +} +/* * Locking to guarantee consistency of non-atomic updates to long long i_size, * consistency between file size and KMS.
@@ -639,6 +656,7 @@ enum ll_sbi_flags {LL_SBI_TINY_WRITE ,/* tiny write support */ LL_SBI_FILE_HEAT ,/* file heat support */ LL_SBI_PARALLEL_DIO ,/* parallel (async) O_DIRECT RPCs */ +LL_SBI_ENCRYPT_NAME ,/* name encryption */ LL_SBI_NUM_FLAGS };
@@ -1727,7 +1745,6 @@ static inline struct pcc_super *ll_info2pccs(struct ll_inode_info *lli) }/* crypto.c */ -#ifdef CONFIG_FS_ENCRYPTION /* The digested form is made of a FID (16 bytes) followed by the second-to-last * ciphertext block (16 bytes), so a total length of 32 bytes. * That way, fscrypt does not compute a digested form of this digest.
@@ -1737,6 +1754,14 @@ struct ll_digest_filename {char ldf_excerpt[FS_CRYPTO_BLOCK_SIZE ]; }; +static inline char *xattr_for_enc (struct inode *inode) +{ +if (ll_sbi_has_name_encrypt (ll_i2sbi (inode))) +return LL_XATTR_NAME_ENCRYPTION_CONTEXT ; + +return LL_XATTR_NAME_ENCRYPTION_CONTEXT_OLD ; +} +#ifdef CONFIG_FS_ENCRYPTION int ll_setup_filename (struct inode *dir,const struct qstr *iname,int lookup,struct fscrypt_name *fname,struct lu_fid *fid);
@@ -1752,7 +1777,6 @@ int ll_setup_filename(struct inode *dir, const struct qstr *iname, {return fscrypt_setup_filename (dir, iname, lookup, fname); } -int ll_fname_disk_to_usr (struct inode *inode,u32 hash,u32 minor_hash,struct fscrypt_str *iname,struct fscrypt_str *oname)
fs/lustre/llite/llite_lib.c +13 -1
@@ -173,6 +173,7 @@ static struct ll_sb_info *ll_init_sbi(void)set_bit (LL_SBI_TINY_WRITE , sbi->ll_flags);set_bit (LL_SBI_PARALLEL_DIO , sbi->ll_flags);ll_sbi_set_encrypt (sbi, true); +ll_sbi_set_name_encrypt (sbi, true);/* root squash */ sbi->ll_squash.rsi_uid =0 ;
@@ -349,8 +350,10 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt) data->ocd_connect_flags &= ~OBD_CONNECT_PINGLESS ;obd_connect_set_secctx (data); -if (ll_sbi_has_encrypt (sbi)) +if (ll_sbi_has_encrypt (sbi)) { +obd_connect_set_name_enc (data);obd_connect_set_enc (data); + }#if defined(CONFIG_SECURITY ) data->ocd_connect_flags2 |=OBD_CONNECT2_SELINUX_POLICY ;
@@ -482,6 +485,14 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt)ll_sbi_set_encrypt (sbi, false); } +if (ll_sbi_has_name_encrypt (sbi) && !obd_connect_has_name_enc (data)) { +if (ll_sb_has_test_dummy_encryption (sb)) +LCONSOLE_WARN ("%s: server %s does not support name encryption, not using it.\n" , + sbi->ll_fsname, + sbi->ll_md_exp->exp_obd->obd_name); +ll_sbi_set_name_encrypt (sbi, false); + } +if (data->ocd_ibits_known &MDS_INODELOCK_XATTR ) {if (!(data->ocd_connect_flags &OBD_CONNECT_MAX_EASIZE )) { LCONSOLE_INFO("%s: disabling xattr cache due to unknown maximum xattr size.\n",
@@ -928,6 +939,7 @@ void ll_kill_super(struct super_block *sb) {LL_SBI_TINY_WRITE, "tiny_write"}, {LL_SBI_FILE_HEAT, "file_heat"}, {LL_SBI_PARALLEL_DIO, "parallel_dio"}, + {LL_SBI_ENCRYPT_NAME, "name_encrypt"}, };int ll_sbi_flags_seq_show (struct seq_file *m,void *v)
fs/lustre/llite/namei.c +1 -1
@@ -668,7 +668,7 @@ static int ll_lookup_it_finish(struct ptlrpc_request *request,"server returned encryption ctx for " DFID "\n" , PFID(ll_inode2fid(inode))); rc =ll_xattr_cache_insert (inode, -LL_XATTR_NAME_ENCRYPTION_CONTEXT , +xattr_for_enc (inode), encctx, encctxlen);if (rc) { CWARN("%s: cannot set enc ctx for " DFID ": rc = %d\n",
fs/lustre/llite/statahead.c +1 -1
@@ -682,7 +682,7 @@ static void sa_instantiate(struct ll_statahead_info *sai,"server returned encryption ctx for " DFID "\n" , PFID(ll_inode2fid(child))); rc =ll_xattr_cache_insert (child, -LL_XATTR_NAME_ENCRYPTION_CONTEXT , +xattr_for_enc (child), encctx, encctxlen);if (rc) CWARN("%s: cannot set enc ctx for "DFID": rc = %d\n",
fs/lustre/llite/symlink.c +1 -1
@@ -38,7 +38,7 @@#include "llite_internal.h" /* Must be called with lli_size_mutex locked */ -/* HAVE_IOP_GET_LINK is defined from kernel 4.5, whereas +/* iop->get_link is defined from kernel 4.5, whereas * IS_ENCRYPTED is brought by kernel 4.14. * So there is no need to handle encryption case otherwise. */
fs/lustre/llite/xattr_cache.c +4 -4
@@ -109,7 +109,8 @@ static int ll_xattr_cache_add(struct list_head *cache,struct ll_xattr_entry *xattr;if (ll_xattr_cache_find (cache, xattr_name, &xattr) ==0 ) { -if (!strcmp (xattr_name,LL_XATTR_NAME_ENCRYPTION_CONTEXT )) +if (!strcmp (xattr_name,LL_XATTR_NAME_ENCRYPTION_CONTEXT ) || + !strcmp (xattr_name,LL_XATTR_NAME_ENCRYPTION_CONTEXT_OLD ))/* it means enc ctx was already in cache, * ignore error as it cannot be modified */
@@ -288,8 +289,7 @@ int ll_xattr_cache_empty(struct inode *inode) goto out_empty;list_for_each_entry_safe (entry, n, &lli->lli_xattrs, xe_list) { -if (strcmp (entry->xe_name, -LL_XATTR_NAME_ENCRYPTION_CONTEXT ) ==0 ) +if (strcmp (entry->xe_name,xattr_for_enc (inode)) ==0 )continue ;CDEBUG (D_CACHE ,"delete: %s\n" , entry->xe_name);
@@ -534,7 +534,7 @@ int ll_xattr_cache_get(struct inode *inode, const char *name, char *buffer,* cache if we are just interested in encryption context. */ if ((valid &OBD_MD_FLXATTRLS || -strcmp (name,LL_XATTR_NAME_ENCRYPTION_CONTEXT ) !=0 ) && +strcmp (name,xattr_for_enc (inode)) !=0 ) && !ll_xattr_cache_filled (lli)) {up_read (&lli->lli_xattrs_list_rwsem); rc =ll_xattr_cache_refill (inode);
fs/lustre/obdclass/lprocfs_status.c +1 -0
@@ -137,6 +137,7 @@"mne_nid_type" ,/* 0x1000000 */ "lock_contend" ,/* 0x2000000 */ "atomic_open_lock" ,/* 0x4000000 */ +"name_encryption" ,/* 0x8000000 */ NULL };
fs/lustre/ptlrpc/wiretest.c +2 -0
@@ -1241,6 +1241,8 @@ void lustre_assert_wire_constants(void) OBD_CONNECT2_PCCRO);LASSERTF (OBD_CONNECT2_ATOMIC_OPEN_LOCK ==0x4000000ULL ,"found 0x%.16llxULL\n" ,OBD_CONNECT2_ATOMIC_OPEN_LOCK ); +LASSERTF (OBD_CONNECT2_ENCRYPT_NAME ==0x8000000ULL ,"found 0x%.16llxULL\n" , +OBD_CONNECT2_ENCRYPT_NAME );LASSERTF (OBD_CKSUM_CRC32 ==0x00000001UL ,"found 0x%.8xUL\n" , (unsigned int )OBD_CKSUM_CRC32 ); LASSERTF(OBD_CKSUM_ADLER == 0x00000002UL, "found 0x%.8xUL\n",
include/uapi/linux/lustre/lustre_idl.h +1 -0
@@ -809,6 +809,7 @@ struct ptlrpc_body_v2 {#define OBD_CONNECT2_BATCH_RPC 0x400000ULL/* Multi-RPC batch request */ #define OBD_CONNECT2_PCCRO 0x800000ULL/* Read-only PCC */ #define OBD_CONNECT2_ATOMIC_OPEN_LOCK 0x4000000ULL/* request lock on 1st open */ +#define OBD_CONNECT2_ENCRYPT_NAME 0x8000000ULL/* name encrypt */ /* XXX README XXX: * Please DO NOT add flag values here before first ensuring that this same * flag value is not in use on some other branch. Please clear any such
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 2/24 lustre: lmv: always space-balance r-r directories
In reply to James SimmonsFrom: Lai Siyao <[email protected]>
If the MDT free space is imbalanced, use QOS space balancing for round-robin subdirectory creation, regardless of the depth of the directory tree. Otherwise, new subdirectories created in parents with round-robin default layout may suddenly become "sticky" on the parent MDT and upset the space balancing and load distribution.
WC-bug-id: https://jira.whamcloud.com/browse/LU-15850
Reviewed-on: https://review.whamcloud.com/47578
--- fs/lustre/lmv/lmv_obd.c | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-)
fs/lustre/lmv/lmv_obd.c +22 -16
@@ -55,6 +55,7 @@#include "lmv_internal.h" static int lmv_check_connect (struct obd_device *obd); +static inline bool lmv_op_default_rr_mkdir (const struct md_op_data *op_data);void lmv_activate_target (struct lmv_obd *lmv,struct lmv_tgt_desc *tgt,int activate)
@@ -1446,8 +1447,8 @@ static int lmv_close(struct obd_export *exp, struct md_op_data *op_data,return md_close (tgt->ltd_exp, op_data, mod, request); } -static struct lu_tgt_desc *lmv_locate_tgt_qos (struct lmv_obd *lmv,u32 mdt, -unsigned short dir_depth) +static struct lu_tgt_desc *lmv_locate_tgt_qos (struct lmv_obd *lmv, +struct md_op_data *op_data) {struct lu_tgt_desc *tgt, *cur =NULL ;u64 total_avail =0 ;
@@ -1481,23 +1482,31 @@ static struct lu_tgt_desc *lmv_locate_tgt_qos(struct lmv_obd *lmv, u32 mdt, tgt->ltd_qos.ltq_usable =1 ;lu_tgt_qos_weight_calc (tgt); -if (tgt->ltd_index == mdt) +if (tgt->ltd_index == op_data->op_mds) cur = tgt; total_avail += tgt->ltd_qos.ltq_avail; total_weight += tgt->ltd_qos.ltq_weight; total_usable++; } -/* if current MDT has above-average space, within range of the QOS -* threshold, stay on the same MDT to avoid creating needless remote -* MDT directories. It's more likely for low level directories -* "16 / (dir_depth + 10)" is the factor to make it more unlikely for -* top level directories, while more likely for low levels. +/* If current MDT has above-average space and dir is not aleady using +* round-robin to spread across more MDTs, stay on the parent MDT +* to avoid creating needless remote MDT directories. Remote dirs +* close to the root balance space more effectively than bottom dirs, +* so prefer to create remote dirs at top level of directory tree. +* "16 / (dir_depth + 10)" is the factor to make it less likely +* for top-level directories to stay local unless they have more than +* average free space, while deep dirs prefer local until more full. +* depth=0 -> 160%, depth=3 -> 123%, depth=6 -> 100%, +* depth=9 -> 84%, depth=12 -> 73%, depth=15 -> 64% */ - rand = total_avail *16 / (total_usable * (dir_depth +10 )); -if (cur && cur->ltd_qos.ltq_avail >= rand) { - tgt = cur; - goto unlock; +if (!lmv_op_default_rr_mkdir (op_data)) { + rand = total_avail *16 / + (total_usable * (op_data->op_dir_depth +10 )); +if (cur && cur->ltd_qos.ltq_avail >= rand) { + tgt = cur; + goto unlock; + } } rand =lu_prandom_u64_max (total_weight);
@@ -1836,9 +1845,6 @@ static inline bool lmv_op_default_rr_mkdir(const struct md_op_data *op_data) {const struct lmv_stripe_md *lsm = op_data->op_default_mea1; -if (!lmv_op_default_qos_mkdir (op_data)) -return false; -return (op_data->op_flags &MF_RR_MKDIR ) || (lsm && lsm->lsm_md_max_inherit_rr !=LMV_INHERIT_RR_NONE ) ||fid_is_root (&op_data->op_fid1);
@@ -1873,7 +1879,7 @@ static struct lu_tgt_desc *lmv_locate_tgt_by_space(struct lmv_obd *lmv, {struct lmv_tgt_desc *tmp = tgt; - tgt =lmv_locate_tgt_qos (lmv, op_data->op_mds, op_data->op_dir_depth); + tgt =lmv_locate_tgt_qos (lmv, op_data);if (tgt ==ERR_PTR (-EAGAIN )) { if (ltd_qos_is_balanced(&lmv->lmv_mdt_descs) && !lmv_op_default_rr_mkdir(op_data) &&
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 3/24 lustre: ldlm: rid of obsolete param of ldlm_resource_get()
In reply to James SimmonsFrom: Bobi Jam <[email protected]>
The second parameter @parent of ldlm_resource_get() is obsolete, just remove it.
WC-bug-id: https://jira.whamcloud.com/browse/LU-8238
Lustre-commit: bab7c8998a6539c0d ("LU-8238 ldlm: rid of obsolete param of ldlm_resource_get()")
Reviewed-on: https://review.whamcloud.com/20631
--- fs/lustre/include/lustre_dlm.h | 1 - fs/lustre/ldlm/ldlm_lock.c | 6 +++--- fs/lustre/ldlm/ldlm_request.c | 4 ++-- fs/lustre/ldlm/ldlm_resource.c | 6 ++---- fs/lustre/mdc/mdc_dev.c | 5 +++-- fs/lustre/mdc/mdc_locks.c | 2 +- fs/lustre/mdc/mdc_reint.c | 2 +- fs/lustre/osc/osc_object.c | 6 +++--- fs/lustre/osc/osc_request.c | 2 +- 9 files changed, 16 insertions(+), 18 deletions(-)
fs/lustre/include/lustre_dlm.h +0 -1
@@ -1287,7 +1287,6 @@ static inline void ldlm_svc_get_eopc(const struct ldlm_request *dlm_req,/* resource.c - internal */ 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);
fs/lustre/ldlm/ldlm_lock.c +3 -3
@@ -447,7 +447,7 @@ int ldlm_lock_change_resource(struct ldlm_namespace *ns, struct ldlm_lock *lock, type = oldres->lr_type;unlock_res_and_lock (lock); - newres =ldlm_resource_get (ns,NULL , new_resid, type,1 ); + newres =ldlm_resource_get (ns, new_resid, type,1 );if (IS_ERR (newres))return PTR_ERR (newres);
@@ -1308,7 +1308,7 @@ enum ldlm_mode ldlm_lock_match_with_skip(struct ldlm_namespace *ns, *data.lmd_mode = data.lmd_old->l_req_mode; } - res =ldlm_resource_get (ns,NULL , res_id, type,0 ); + res =ldlm_resource_get (ns, res_id, type,0 );if (IS_ERR (res)) {LASSERT (!data.lmd_old);return 0 ;
@@ -1537,7 +1537,7 @@ struct ldlm_lock *ldlm_lock_create(struct ldlm_namespace *ns,struct ldlm_resource *res;int rc; - res =ldlm_resource_get (ns,NULL , res_id, type,1 ); + res =ldlm_resource_get (ns, res_id, type,1 );if (IS_ERR (res))return ERR_CAST (res);
fs/lustre/ldlm/ldlm_request.c +2 -2
@@ -1887,7 +1887,7 @@ int ldlm_cli_cancel_unused_resource(struct ldlm_namespace *ns,int count;int rc; - res =ldlm_resource_get (ns,NULL , res_id,0 ,0 ); + res =ldlm_resource_get (ns, res_id,0 ,0 );if (IS_ERR (res)) {/* This is not a problem. */ CDEBUG (D_INFO ,"No resource %llu\n" , res_id->name[0 ]);
@@ -2039,7 +2039,7 @@ int ldlm_resource_iterate(struct ldlm_namespace *ns,LASSERTF (ns,"must pass in namespace\n" ); - res =ldlm_resource_get (ns,NULL , res_id,0 ,0 ); + res =ldlm_resource_get (ns, res_id,0 ,0 );if (IS_ERR (res))return 0 ;
fs/lustre/ldlm/ldlm_resource.c +2 -4
@@ -1105,9 +1105,8 @@ static struct ldlm_resource *ldlm_resource_new(enum ldlm_type ldlm_type)* Returns: referenced, unlocked ldlm_resource or NULL */ struct ldlm_resource * -ldlm_resource_get (struct ldlm_namespace *ns,struct ldlm_resource *parent, -const struct ldlm_res_id *name,enum ldlm_type type, -int create) +ldlm_resource_get (struct ldlm_namespace *ns,const struct ldlm_res_id *name, +enum ldlm_type type,int create) {struct hlist_node *hnode;struct ldlm_resource *res =NULL ;
@@ -1116,7 +1115,6 @@ struct ldlm_resource *int ns_refcount =0 ;int hash; -LASSERT (!parent);LASSERT (ns->ns_rs_hash);LASSERT (name->name[0 ] !=0 );
fs/lustre/mdc/mdc_dev.c +3 -2
@@ -998,13 +998,14 @@ static int mdc_get_lock_handle(const struct lu_env *env, struct osc_object *osc,OSC_DAP_FL_TEST_LOCK | OSC_DAP_FL_CANCELING);if (!lock) { +struct ldlm_namespace *ns;struct ldlm_resource *res;struct ldlm_res_id *resname; resname = &osc_env_info (env)->oti_resname;fid_build_reg_res_name (lu_object_fid (osc2lu (osc)), resname); - res =ldlm_resource_get (osc_export (osc)->exp_obd->obd_namespace, -NULL , resname,LDLM_IBITS ,0 ); + ns =osc_export (osc)->exp_obd->obd_namespace; + res =ldlm_resource_get (ns, resname,LDLM_IBITS ,0 );ldlm_resource_dump (D_ERROR , res);libcfs_debug_dumpstack (NULL ); rc = -ENOENT ;
fs/lustre/mdc/mdc_locks.c +1 -1
@@ -177,7 +177,7 @@ int mdc_null_inode(struct obd_export *exp,fid_build_reg_res_name (fid, &res_id); - res =ldlm_resource_get (ns,NULL , &res_id,0 ,0 ); + res =ldlm_resource_get (ns, &res_id,0 ,0 );if (IS_ERR (res))return 0 ;
fs/lustre/mdc/mdc_reint.c +1 -1
@@ -81,7 +81,7 @@ int mdc_resource_get_unused_res(struct obd_export *exp,if (exp_connect_cancelset (exp) && !ns_connect_cancelset (ns))return 0 ; - res =ldlm_resource_get (ns,NULL , res_id,0 ,0 ); + res =ldlm_resource_get (ns, res_id,0 ,0 );if (IS_ERR (res))return 0 ;LDLM_RESOURCE_ADDREF (res);
fs/lustre/osc/osc_object.c +3 -3
@@ -389,6 +389,7 @@ static void osc_req_attr_set(const struct lu_env *env, struct cl_object *obj, lock =osc_dlmlock_at_pgoff (env,cl2osc (obj),osc_index (opg),OSC_DAP_FL_TEST_LOCK |OSC_DAP_FL_CANCELING );if (!lock && !opg->ops_srvlock) { +struct ldlm_namespace *ns;struct ldlm_resource *res;struct ldlm_res_id *resname;
@@ -397,9 +398,8 @@ static void osc_req_attr_set(const struct lu_env *env, struct cl_object *obj, resname = &osc_env_info (env)->oti_resname;ostid_build_res_name (&oinfo->loi_oi, resname); - res =ldlm_resource_get ( -osc_export (cl2osc (obj))->exp_obd->obd_namespace, -NULL , resname,LDLM_EXTENT ,0 ); + ns =osc_export (cl2osc (obj))->exp_obd->obd_namespace; + res =ldlm_resource_get (ns, resname,LDLM_EXTENT ,0 );ldlm_resource_dump (D_ERROR , res);libcfs_debug_dumpstack (NULL );LBUG ();
fs/lustre/osc/osc_request.c +1 -1
@@ -587,7 +587,7 @@ static int osc_resource_get_unused(struct obd_export *exp, struct obdo *oa,return 0 ;ostid_build_res_name (&oa->o_oi, &res_id); - res =ldlm_resource_get (ns,NULL , &res_id,0 ,0 ); + res =ldlm_resource_get (ns, &res_id,0 ,0 );if (IS_ERR (res))return 0 ;
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 4/24 lustre: llite: fully disable readahead in kernel I/O path
In reply to James SimmonsFrom: Qian Yingjin <[email protected]>
In the new kernel (rhel9 or ubuntu 2204), the readahead path may be out of the control of Lustre CLIO engine:
generic_file_read_iter()
->filemap_read()
->filemap_get_pages()
->page_cache_sync_readahead()
->page_cache_sync_ra()void page_cache_sync_ra()
{
if (!ractl->ra->ra_pages || blk_cgroup_congested()) {
if (!ractl->file)
return;
req_count = 1;
do_forced_ra = true;
}
/* be dumb */
if (do_forced_ra) {
force_page_cache_ra(ractl, req_count);
return;
}
...
}From the kernel readahead code, even if read-ahead is disabled (via @ra_pages == 0), it still issues this request as read-ahead as we will need it to satisfy the requested range. The forced read-ahead will do the right thing and limit the read to just the requested range, which we will set to 1 page for this case.
Thus it can not totally avoid the read-ahead in the kernel I/O path only by setting @ra_pages with 0.
To fully disable the read-ahead in the Linux kernel I/O path, we still need to set @io_pages to 0, it will set I/O range to 0 in @force_page_cache_ra():
void force_page_cache_ra()
{
...
max_pages = = max_t(unsigned long, bdi->io_pages,
ra->ra_pages);
nr_to_read = min_t(unsigned long, nr_to_read, max_pages);
while (nr_to_read) {
...
}
...
}After set bdi->io_pages with 0, it can pass the sanity/101j.
WC-bug-id: https://jira.whamcloud.com/browse/LU-16019
Lustre-commit: f0cf7fd3cccb2313f ("LU-16019 llite: fully disable readahead in kernel I/O path")
Reviewed-on: https://review.whamcloud.com/47993
--- fs/lustre/llite/llite_lib.c | 1 + 1 file changed, 1 insertion(+)
fs/lustre/llite/llite_lib.c +1 -0
@@ -1261,6 +1261,7 @@ int ll_fill_super(struct super_block *sb)/* disable kernel readahead */ sb->s_bdi->ra_pages =0 ; + sb->s_bdi->io_pages =0 ;/* Call ll_debugsfs_register_super() before lustre_process_log() * so that "llite.*.*" params can be processed correctly.
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 5/24 lustre: llite: use fatal_signal_pending in range_lock
In reply to James SimmonsFrom: Qian Yingjin <[email protected]>
FIO io_uring failed with one file shared by two FIO processes under newer kernels.
After analyzed, we found that range_lock() function return -ERESTARTSYS when there pending signal on current process in Lustre I/O. This causes -EINTR returned to the application.
we solve this bug by replacing @signal_pending(current) with @fatal_signal_pending(current) in range_lock(). The range_lock() function only returns -ERESTARTSYS when the current process has fatal pending signal such as SIGKILL.
WC-bug-id: https://jira.whamcloud.com/browse/LU-15994
Lustre-commit: 4c5b0b0967f052af3 ("LU-15994 llite: use fatal_signal_pending in range_lock")
Reviewed-on: https://review.whamcloud.com/48106
--- fs/lustre/obdclass/range_lock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/lustre/obdclass/range_lock.c +1 -1
@@ -159,7 +159,7 @@ int range_lock(struct range_lock_tree *tree, struct range_lock *lock)spin_unlock (&tree->rlt_lock);schedule (); -if (signal_pending (current)) { +if (fatal_signal_pending (current)) {range_unlock (tree, lock); rc = -ERESTARTSYS ; goto out;
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 6/24 lustre: update version to 2.15.51
In reply to James SimmonsFrom: Oleg Drokin <[email protected]>
New tag 2.15.51
--- include/uapi/linux/lustre/lustre_ver.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/uapi/linux/lustre/lustre_ver.h +2 -2
@@ -3,9 +3,9 @@#define LUSTRE_MAJOR 2#define LUSTRE_MINOR 15 -#define LUSTRE_PATCH 50 +#define LUSTRE_PATCH 51#define LUSTRE_FIX 0 -#define LUSTRE_VERSION_STRING "2.15.50" +#define LUSTRE_VERSION_STRING "2.15.51"#define OBD_OCD_VERSION (major, minor, patch, fix) \ (((major) << 24) + ((minor) << 16) + ((patch) << 8) + (fix))
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 7/24 lustre: llite: simplify callback handling for async getattr
In reply to James SimmonsFrom: Qian Yingjin <[email protected]>
In this patch, it prepares the inode and set lock data directly in the callback interpret of the intent async getattr RPC request (in ptlrpcd context), simplifies the old impementation that defer this work in the statahead thread.
If the statahead entry is a striped directory, it may generate new RPCs in the ptlrpcd interpret context to obtain the attributes for slaves of the striped directory:
@ll_prep_inode()->@lmv_revaildate_slaves()
This is dangerous and may result in deadlock in ptlrpcd interpret context, thus we use work queue to handle these extra RPCs. Add sanity 123d to verify that it works correctly.
According to the benchmark result, the workload "ls -l" to a large directory on a client without any caching (server and client), containing 1M files (47001 bytes) shows the results with measured elapsed time:
- w/o patch: 180 seconds;
- w patch: 181 seconds;
There is no any obvious performance regession.
WC-bug-id: https://jira.whamcloud.com/browse/LU-14139
Lustre-commit: 509d7305ce8a01351 ("LU-14139 llite: simplify callback handling for async getattr")
Reviewed-on: https://review.whamcloud.com/45648
--- fs/lustre/include/lustre_intent.h | 2 + fs/lustre/include/obd.h | 27 +-- fs/lustre/include/obd_class.h | 4 +- fs/lustre/llite/llite_internal.h | 17 +- fs/lustre/llite/llite_lib.c | 8 + fs/lustre/llite/statahead.c | 380 +++++++++++++++++++------------------- fs/lustre/lmv/lmv_obd.c | 6 +- fs/lustre/mdc/mdc_internal.h | 3 +- fs/lustre/mdc/mdc_locks.c | 30 +-- 9 files changed, 241 insertions(+), 236 deletions(-)
fs/lustre/include/lustre_intent.h +2 -0
@@ -50,6 +50,8 @@ struct lookup_intent {u64 it_remote_lock_handle;struct ptlrpc_request *it_request; unsigned int it_lock_set:1; + unsigned int it_extra_rpc_check:1; + unsigned int it_extra_rpc_need:1; };static inline int it_disposition (struct lookup_intent *it,int flag)
fs/lustre/include/obd.h +14 -13
@@ -834,18 +834,19 @@ struct md_readdir_info {int mr_partial_readdir_rc; }; -struct md_enqueue_info ; -/* metadata stat-ahead */ - -struct md_enqueue_info { -struct md_op_data mi_data; -struct lookup_intent mi_it; -struct lustre_handle mi_lockh; -struct inode *mi_dir; -struct ldlm_enqueue_info mi_einfo; -int (*mi_cb)(struct ptlrpc_request *req, -struct md_enqueue_info *minfo,int rc); -void *mi_cbdata; +struct md_op_item ; +typedef int (*md_op_item_cb_t )(struct req_capsule *pill, +struct md_op_item *item, +int rc); + +struct md_op_item { +struct md_op_data mop_data; +struct lookup_intent mop_it; +struct lustre_handle mop_lockh; +struct ldlm_enqueue_info mop_einfo; +md_op_item_cb_t mop_cb; +void *mop_cbdata; +struct inode *mop_dir; };struct obd_ops {
@@ -1078,7 +1079,7 @@ struct md_ops { struct lu_fid *fid);int (*intent_getattr_async)(struct obd_export *exp, -struct md_enqueue_info *minfo); +struct md_op_item *item);int (*revalidate_lock)(struct obd_export *,struct lookup_intent *,struct lu_fid *,u64 *bits);
fs/lustre/include/obd_class.h +2 -2
@@ -1593,7 +1593,7 @@ static inline int md_init_ea_size(struct obd_export *exp, u32 easize, }static inline int md_intent_getattr_async (struct obd_export *exp, -struct md_enqueue_info *minfo) +struct md_op_item *item) {int rc;
@@ -1604,7 +1604,7 @@ static inline int md_intent_getattr_async(struct obd_export *exp,lprocfs_counter_incr (exp->exp_obd->obd_md_stats,LPROC_MD_INTENT_GETATTR_ASYNC ); -return MDP (exp->exp_obd, intent_getattr_async)(exp, minfo); +return MDP (exp->exp_obd, intent_getattr_async)(exp, item); } static inline int md_revalidate_lock(struct obd_export *exp,
fs/lustre/llite/llite_internal.h +9 -8
@@ -1504,17 +1504,12 @@ struct ll_statahead_info {* is not a hidden one */ unsigned int sai_skip_hidden;/* skipped hidden dentry count */ - unsigned int sai_ls_all:1, /* "ls -al", do stat-ahead for -* hidden entries -*/ - sai_in_readpage:1;/* statahead in readdir() */ + unsigned int sai_ls_all:1; /* "ls -al", do stat-ahead for +* hidden entries +*/ wait_queue_head_t sai_waitq;/* stat-ahead wait queue */ struct task_struct *sai_task;/* stat-ahead thread */ struct task_struct *sai_agl_task;/* AGL thread */ -struct list_head sai_interim_entries;/* entries which got async -* stat reply, but not -* instantiated -*/ struct list_head sai_entries;/* completed entries */ struct list_head sai_agls;/* AGLs to be sent */ struct list_head sai_cache[LL_SA_CACHE_SIZE ];
@@ -1522,6 +1517,12 @@ struct ll_statahead_info {atomic_t sai_cache_count;/* entry count in cache */ }; +struct ll_interpret_work { +struct work_struct lpw_work; +struct md_op_item *lpw_item; +struct req_capsule *lpw_pill; +}; +int ll_revalidate_statahead (struct inode *dir,struct dentry **dentry,bool unplug);int ll_start_statahead (struct inode *dir,struct dentry *dentry,bool agl);
fs/lustre/llite/llite_lib.c +8 -0
@@ -3080,6 +3080,14 @@ int ll_prep_inode(struct inode **inode, struct req_capsule *pill,if (rc) goto out; +if (S_ISDIR (md.body->mbo_mode) && md.lmv &&lmv_dir_striped (md.lmv) && + it && it->it_extra_rpc_check) { +/* TODO: Check @lsm unchanged via @lsm_md_eq. */ + it->it_extra_rpc_need =1 ; + rc = -EAGAIN ; + goto out; + } +/* * clear default_lmv only if intent_getattr reply doesn't contain it. * but it needs to be done after iget, check this early because
fs/lustre/llite/statahead.c +187 -193
589 lines not on this page · raw message
fs/lustre/lmv/lmv_obd.c +3 -3
@@ -3626,9 +3626,9 @@ static int lmv_clear_open_replay_data(struct obd_export *exp, }static int lmv_intent_getattr_async (struct obd_export *exp, -struct md_enqueue_info *minfo) +struct md_op_item *item) { -struct md_op_data *op_data = &minfo->mi_data; +struct md_op_data *op_data = &item->mop_data;struct obd_device *obd = exp->exp_obd;struct lmv_obd *lmv = &obd->u.lmv;struct lmv_tgt_desc *ptgt =NULL ;
@@ -3652,7 +3652,7 @@ static int lmv_intent_getattr_async(struct obd_export *exp,if (ctgt != ptgt)return -EREMOTE ; -return md_intent_getattr_async (ptgt->ltd_exp, minfo); +return md_intent_getattr_async (ptgt->ltd_exp, item); } static int lmv_revalidate_lock(struct obd_export *exp, struct lookup_intent *it,
fs/lustre/mdc/mdc_internal.h +1 -2
@@ -130,8 +130,7 @@ int mdc_cancel_unused(struct obd_export *exp, const struct lu_fid *fid,int mdc_revalidate_lock (struct obd_export *exp,struct lookup_intent *it,struct lu_fid *fid,u64 *bits); -int mdc_intent_getattr_async (struct obd_export *exp, -struct md_enqueue_info *minfo); +int mdc_intent_getattr_async (struct obd_export *exp,struct md_op_item *item); enum ldlm_mode mdc_lock_match(struct obd_export *exp, u64 flags, const struct lu_fid *fid, enum ldlm_type type,
fs/lustre/mdc/mdc_locks.c +15 -15
@@ -49,7 +49,7 @@struct mdc_getattr_args {struct obd_export *ga_exp; -struct md_enqueue_info *ga_minfo; +struct md_op_item *ga_item; };int it_open_error (int phase,struct lookup_intent *it)
@@ -1365,10 +1365,10 @@ static int mdc_intent_getattr_async_interpret(const struct lu_env *env, {struct mdc_getattr_args *ga = args;struct obd_export *exp = ga->ga_exp; -struct md_enqueue_info *minfo = ga->ga_minfo; -struct ldlm_enqueue_info *einfo = &minfo->mi_einfo; -struct lookup_intent *it = &minfo->mi_it; -struct lustre_handle *lockh = &minfo->mi_lockh; +struct md_op_item *item = ga->ga_item; +struct ldlm_enqueue_info *einfo = &item->mop_einfo; +struct lookup_intent *it = &item->mop_it; +struct lustre_handle *lockh = &item->mop_lockh;struct ldlm_reply *lockrep;u64 flags =LDLM_FL_HAS_INTENT ;
@@ -1393,18 +1393,18 @@ static int mdc_intent_getattr_async_interpret(const struct lu_env *env,if (rc) goto out; - rc =mdc_finish_intent_lock (exp, req, &minfo->mi_data, it, lockh); + rc =mdc_finish_intent_lock (exp, req, &item->mop_data, it, lockh); out: - minfo->mi_cb (req, minfo, rc); + item->mop_cb (&req->rq_pill, item, rc);return 0 ; }int mdc_intent_getattr_async (struct obd_export *exp, -struct md_enqueue_info *minfo) +struct md_op_item *item) { -struct md_op_data *op_data = &minfo->mi_data; -struct lookup_intent *it = &minfo->mi_it; +struct md_op_data *op_data = &item->mop_data; +struct lookup_intent *it = &item->mop_it;struct ptlrpc_request *req;struct mdc_getattr_args *ga;struct ldlm_res_id res_id;
@@ -1433,11 +1433,11 @@ int mdc_intent_getattr_async(struct obd_export *exp,* to avoid possible races. It is safe to have glimpse handler * for non-DOM locks and costs nothing. */ -if (!minfo->mi_einfo.ei_cb_gl) - minfo->mi_einfo.ei_cb_gl = mdc_ldlm_glimpse_ast; +if (!item->mop_einfo.ei_cb_gl) + item->mop_einfo.ei_cb_gl = mdc_ldlm_glimpse_ast; - rc =ldlm_cli_enqueue (exp, &req, &minfo->mi_einfo, &res_id, &policy, - &flags,NULL ,0 ,LVB_T_NONE , &minfo->mi_lockh,1 ); + rc =ldlm_cli_enqueue (exp, &req, &item->mop_einfo, &res_id, &policy, + &flags,NULL ,0 ,LVB_T_NONE , &item->mop_lockh,1 );if (rc <0 ) {ptlrpc_req_finished (req);return rc;
@@ -1445,7 +1445,7 @@ int mdc_intent_getattr_async(struct obd_export *exp, ga =ptlrpc_req_async_args (ga, req); ga->ga_exp = exp; - ga->ga_minfo = minfo; + ga->ga_item = item; req->rq_interpret_reply = mdc_intent_getattr_async_interpret;ptlrpcd_add_req (req);
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 8/24 lustre: statahead: add total hit/miss count stats
In reply to James SimmonsFrom: Qian Yingjin <[email protected]>
In this patch, it adds total hit/miss count stats for statahead. These statistics are updated when the statahead thread terminated.
This patch also adds support to clear all statahead stats:
$LCTL set_param llite.*.statahead_stats=0
WC-bug-id: https://jira.whamcloud.com/browse/LU-14139
Lustre-commit: b9167201a00e38ce8 ("LU-14139 statahead: add total hit/miss count stats")
Reviewed-on: https://review.whamcloud.com/46309
--- fs/lustre/llite/llite_internal.h | 2 ++ fs/lustre/llite/llite_lib.c | 2 ++ fs/lustre/llite/lproc_llite.c | 26 +++++++++++++++++++++++--- fs/lustre/llite/statahead.c | 3 +++ 4 files changed, 30 insertions(+), 3 deletions(-)
fs/lustre/llite/llite_internal.h +2 -0
@@ -749,6 +749,8 @@ struct ll_sb_info {* count */ atomic_t ll_agl_total;/* AGL thread started count */ +atomic_t ll_sa_hit_total;/* total hit count */ +atomic_t ll_sa_miss_total;/* total miss count */ dev_t ll_sdev_orig;/* save s_dev before assign for * clustered nfs
fs/lustre/llite/llite_lib.c +2 -0
@@ -168,6 +168,8 @@ static struct ll_sb_info *ll_init_sbi(void)atomic_set (&sbi->ll_sa_wrong,0 );atomic_set (&sbi->ll_sa_running,0 );atomic_set (&sbi->ll_agl_total,0 ); +atomic_set (&sbi->ll_sa_hit_total,0 ); +atomic_set (&sbi->ll_sa_miss_total,0 );set_bit (LL_SBI_AGL_ENABLED , sbi->ll_flags);set_bit (LL_SBI_FAST_READ , sbi->ll_flags);set_bit (LL_SBI_TINY_WRITE , sbi->ll_flags);
fs/lustre/llite/lproc_llite.c +23 -3
@@ -843,14 +843,34 @@ static int ll_statahead_stats_seq_show(struct seq_file *m, void *v)seq_printf (m,"statahead total: %u\n" "statahead wrong: %u\n" -"agl total: %u\n" , +"agl total: %u\n" +"hit_total: %u\n" +"miss_total: %u\n" ,atomic_read (&sbi->ll_sa_total),atomic_read (&sbi->ll_sa_wrong), -atomic_read (&sbi->ll_agl_total)); +atomic_read (&sbi->ll_agl_total), +atomic_read (&sbi->ll_sa_hit_total), +atomic_read (&sbi->ll_sa_miss_total));return 0 ; } -LDEBUGFS_SEQ_FOPS_RO (ll_statahead_stats); +static ssize_t ll_statahead_stats_seq_write (struct file *file, +const char __user *buffer, +size_t count,loff_t *off) +{ +struct seq_file *m = file->private_data; +struct super_block *sb = m->private; +struct ll_sb_info *sbi =ll_s2sbi (sb); + +atomic_set (&sbi->ll_sa_total,0 ); +atomic_set (&sbi->ll_sa_wrong,0 ); +atomic_set (&sbi->ll_agl_total,0 ); +atomic_set (&sbi->ll_sa_hit_total,0 ); +atomic_set (&sbi->ll_sa_miss_total,0 ); + +return count; +} +LDEBUGFS_SEQ_FOPS (ll_statahead_stats); static ssize_t lazystatfs_show(struct kobject *kobj, struct attribute *attr,
fs/lustre/llite/statahead.c +3 -0
@@ -1224,6 +1224,9 @@ static int ll_statahead_thread(void *arg)spin_unlock (&lli->lli_sa_lock);wake_up (&sai->sai_waitq); +atomic_add (sai->sai_hit, &sbi->ll_sa_hit_total); +atomic_add (sai->sai_miss, &sbi->ll_sa_miss_total); +ll_sai_put (sai);return rc;
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 9/24 lnet: o2iblnd: Salt comp_vector
In reply to James SimmonsFrom: Ian Ziemba <[email protected]>
If conns_per_peer is greater than 1, all the connections targeting the same peer are assigned the same comp_vector. This results in multiple IB CQs targeting the same peer to be serialized on a single comp_vector.
Help spread out the IB CQ work to multiple cores by salting comp_vector based on number of connections.
1 client to 1 server LST 1M write results with 4 conns_per_peer and RXE configured to spread out work based on comp_vector.
Before: 1377.92 MB/s
After: 3828.48 MB/s
HPE-bug-id: LUS-11043
WC-bug-id: https://jira.whamcloud.com/browse/LU-16078
Lustre-commit: 1ef1fa06b20c424f5 ("LU-16078 o2iblnd: Salt comp_vector")
Reviewed-on: https://review.whamcloud.com/48148
--- net/lnet/klnds/o2iblnd/o2iblnd.c | 14 +++++++++++--- net/lnet/klnds/o2iblnd/o2iblnd.h | 2 ++ 2 files changed, 13 insertions(+), 3 deletions(-)
net/lnet/klnds/o2iblnd/o2iblnd.c +11 -3
@@ -338,6 +338,7 @@ int kiblnd_create_peer(struct lnet_ni *ni, struct kib_peer_ni **peerp, peer_ni->ibp_queue_depth = ni->ni_net->net_tunables.lct_peer_tx_credits; peer_ni->ibp_queue_depth_mod =0 ;/* try to use the default */ kref_init (&peer_ni->ibp_kref); +atomic_set (&peer_ni->ibp_nconns,0 );INIT_HLIST_NODE (&peer_ni->ibp_list);INIT_LIST_HEAD (&peer_ni->ibp_conns);
@@ -569,7 +570,7 @@ static int kiblnd_get_completion_vector(struct kib_conn *conn, int cpt)int vectors;int off;int i; -lnet_nid_t nid = conn->ibc_peer->ibp_nid; +lnet_nid_t ibp_nid; vectors = conn->ibc_cmid->device->num_comp_vectors;if (vectors <=1 )
@@ -579,8 +580,13 @@ static int kiblnd_get_completion_vector(struct kib_conn *conn, int cpt)if (!mask)return 0 ; -/* hash NID to CPU id in this partition... */ - off =do_div (nid,cpumask_weight (*mask)); +/* hash NID to CPU id in this partition... when targeting a single peer +* with multiple QPs, to engage more cores in CQ processing to a single +* peer, use ibp_nconns to salt the value the comp_vector value +*/ + ibp_nid = conn->ibc_peer->ibp_nid + +atomic_read (&conn->ibc_peer->ibp_nconns); + off =do_div (ibp_nid,cpumask_weight (*mask));for_each_cpu (i, *mask) {if (!off--)return i % vectors;
@@ -889,6 +895,7 @@ struct kib_conn *kiblnd_create_conn(struct kib_peer_ni *peer_ni, conn->ibc_state = state;/* 1 more conn */ +atomic_inc (&peer_ni->ibp_nconns);atomic_inc (&net->ibn_nconns);return conn;
@@ -954,6 +961,7 @@ void kiblnd_destroy_conn(struct kib_conn *conn)kiblnd_peer_decref (peer_ni);rdma_destroy_id (cmid); +atomic_dec (&peer_ni->ibp_nconns);atomic_dec (&net->ibn_nconns); } }
net/lnet/klnds/o2iblnd/o2iblnd.h +2 -0
@@ -522,6 +522,8 @@ struct kib_peer_ni {u16 ibp_queue_depth;/* reduced value which allows conn to be created if max fails */ u16 ibp_queue_depth_mod; +/* Number of connections allocated. */ +atomic_t ibp_nconns; };extern struct kib_data kiblnd_data;
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 10/24 lnet: selftest: use preallocate bulk for server
In reply to James SimmonsFrom: Alexey Lyashkov <[email protected]>
Server side want to have a preallocate bulk to avoid large lock contention on the page cache.
Without it LST limited with 35Gb/s speed with 3 rail host (HDR each) due large CPU usage.
Preallocate bulks increase a memory consumption for small bulk, but performance improved dramatically up to 74Gb/s with very low cpu usage.
WC-bug-id: https://jira.whamcloud.com/browse/LU-16011
Lustre-commit: 2447564e120cf6226 ("LU-16011 lnet: use preallocate bulk for server")
Reviewed-on: https://review.whamcloud.com/47952
--- net/lnet/selftest/brw_test.c | 67 ++++++++++++++++++++++++++++++------------- net/lnet/selftest/framework.c | 18 +++++------- net/lnet/selftest/rpc.c | 51 +++++++++++++++++++++----------- net/lnet/selftest/selftest.h | 15 ++++++---- 4 files changed, 99 insertions(+), 52 deletions(-)
net/lnet/selftest/brw_test.c +47 -20
@@ -124,11 +124,12 @@list_for_each_entry (tsu, &tsi->tsi_units, tsu_list) { bulk =srpc_alloc_bulk (lnet_cpt_of_nid (tsu->tsu_dest.nid,NULL ), - off, npg, len, opc ==LST_BRW_READ ); + npg);if (!bulk) {brw_client_fini (tsi);return -ENOMEM ; } +srpc_init_bulk (bulk, off, npg, len, opc ==LST_BRW_READ ); tsu->tsu_private = bulk; }
@@ -389,8 +390,6 @@ static int brw_inject_one_error(void)CDEBUG (D_NET ,"Transferred %d pages bulk data %s %s\n" , blk->bk_niov, blk->bk_sink ?"from" :"to" ,libcfs_id2str (rpc->srpc_peer)); - -sfw_free_pages (rpc); } static int
@@ -438,7 +437,6 @@ static int brw_inject_one_error(void)struct srpc_brw_reply *reply = &replymsg->msg_body.brw_reply;struct srpc_brw_reqst *reqst = &reqstmsg->msg_body.brw_reqst;int npg; -int rc;LASSERT (sv->sv_id ==SRPC_SERVICE_BRW );
@@ -489,11 +487,8 @@ static int brw_inject_one_error(void)return 0 ; } - rc =sfw_alloc_pages (rpc, rpc->srpc_scd->scd_cpt, npg, - reqst->brw_len, - reqst->brw_rw ==LST_BRW_WRITE ); -if (rc) -return rc; +srpc_init_bulk (rpc->srpc_bulk,0 , npg, reqst->brw_len, + reqst->brw_rw ==LST_BRW_WRITE );if (reqst->brw_rw ==LST_BRW_READ )brw_fill_bulk (rpc->srpc_bulk, reqst->brw_flags,BRW_MAGIC );
@@ -503,23 +498,55 @@ static int brw_inject_one_error(void)return 0 ; } -struct sfw_test_client_ops brw_test_client; +static int +brw_srpc_init (struct srpc_server_rpc *rpc,int cpt) +{ +/* just alloc a maximal size - actual values will be adjusted later */ + rpc->srpc_bulk =srpc_alloc_bulk (cpt,LNET_MAX_IOV ); +if (!rpc->srpc_bulk) +return -ENOMEM ; + +srpc_init_bulk (rpc->srpc_bulk,0 ,LNET_MAX_IOV ,0 ,0 ); + +return 0 ; +} -void brw_init_test_client (void ) +static void +brw_srpc_fini (struct srpc_server_rpc *rpc) { - brw_test_client.tso_init = brw_client_init; - brw_test_client.tso_fini = brw_client_fini; - brw_test_client.tso_prep_rpc = brw_client_prep_rpc; - brw_test_client.tso_done_rpc = brw_client_done_rpc; +/* server RPC have just MAX_IOV size */ +srpc_init_bulk (rpc->srpc_bulk,0 ,LNET_MAX_IOV ,0 ,0 ); + +srpc_free_bulk (rpc->srpc_bulk); + rpc->srpc_bulk =NULL ; +} + +struct sfw_test_client_ops brw_test_client = { + .tso_init = brw_client_init, + .tso_fini = brw_client_fini, + .tso_prep_rpc = brw_client_prep_rpc, + .tso_done_rpc = brw_client_done_rpc, }; -struct srpc_service brw_test_service; +struct srpc_service brw_test_service = { + .sv_id =SRPC_SERVICE_BRW , + .sv_name ="brw_test" , + .sv_handler = brw_server_handle, + .sv_bulk_ready = brw_bulk_ready, + + .sv_srpc_init = brw_srpc_init, + .sv_srpc_fini = brw_srpc_fini, +};void brw_init_test_service (void ) { - brw_test_service.sv_id =SRPC_SERVICE_BRW ; - brw_test_service.sv_name ="brw_test" ; - brw_test_service.sv_handler = brw_server_handle; - brw_test_service.sv_bulk_ready = brw_bulk_ready; +unsigned long cache_size =totalram_pages () >>1 ; + +/* brw prealloc cache should don't eat more than half memory */ + cache_size /=LNET_MAX_IOV ; + brw_test_service.sv_wi_total = brw_srv_workitems; + +if (brw_test_service.sv_wi_total > cache_size) + brw_test_service.sv_wi_total = cache_size; }
net/lnet/selftest/framework.c +7 -11
@@ -290,8 +290,10 @@swi_state2str (rpc->srpc_wi.swi_state), status); -if (rpc->srpc_bulk) -sfw_free_pages (rpc); +if (rpc->srpc_bulk) { +srpc_free_bulk (rpc->srpc_bulk); + rpc->srpc_bulk =NULL ; + } } static void
@@ -1088,13 +1090,6 @@return -ENOENT ; } -void -sfw_free_pages (struct srpc_server_rpc *rpc) -{ -srpc_free_bulk (rpc->srpc_bulk); - rpc->srpc_bulk =NULL ; -} -int sfw_alloc_pages (struct srpc_server_rpc *rpc,int cpt,int npages,int len,int sink)
@@ -1102,10 +1097,12 @@LASSERT (!rpc->srpc_bulk);LASSERT (npages >0 && npages <=LNET_MAX_IOV ); - rpc->srpc_bulk =srpc_alloc_bulk (cpt,0 , npages, len, sink); + rpc->srpc_bulk =srpc_alloc_bulk (cpt, npages);if (!rpc->srpc_bulk)return -ENOMEM ; +srpc_init_bulk (rpc->srpc_bulk,0 , npages, len, sink); +return 0 ; }
@@ -1629,7 +1626,6 @@ struct srpc_client_rpc *INIT_LIST_HEAD (&sfw_data.fw_zombie_rpcs);INIT_LIST_HEAD (&sfw_data.fw_zombie_sessions); -brw_init_test_client ();brw_init_test_service (); rc =sfw_register_test (&brw_test_service, &brw_test_client);LASSERT (!rc);
net/lnet/selftest/rpc.c +35 -16
120 lines not on this page · raw message
net/lnet/selftest/selftest.h +10 -5
@@ -316,6 +316,12 @@ struct srpc_service {*/ int (*sv_handler)(struct srpc_server_rpc *);int (*sv_bulk_ready)(struct srpc_server_rpc *,int ); + +/** Service side srpc constructor/destructor. +* used for the bulk preallocation as usual. +*/ +int (*sv_srpc_init)(struct srpc_server_rpc *rpc,int cpt); +void (*sv_srpc_fini)(struct srpc_server_rpc *rpc); };struct sfw_session {
@@ -424,7 +430,6 @@ int sfw_create_test_rpc(struct sfw_test_unit *tsu,void sfw_post_rpc (struct srpc_client_rpc *rpc);void sfw_client_rpc_done (struct srpc_client_rpc *rpc);void sfw_unpack_message (struct srpc_msg *msg); -void sfw_free_pages (struct srpc_server_rpc *rpc);void sfw_add_bulk_page (struct srpc_bulk *bk,struct page *pg,int i);int sfw_alloc_pages (struct srpc_server_rpc *rpc,int cpt,int npages,int len,int sink);
@@ -439,9 +444,10 @@ struct srpc_client_rpc *void srpc_post_rpc (struct srpc_client_rpc *rpc);void srpc_abort_rpc (struct srpc_client_rpc *rpc,int why);void srpc_free_bulk (struct srpc_bulk *bk); -struct srpc_bulk *srpc_alloc_bulk (int cpt,unsigned int off, -unsigned int bulk_npg,unsigned int bulk_len, -int sink); +struct srpc_bulk *srpc_alloc_bulk (int cpt,unsigned int bulk_npg); +void srpc_init_bulk (struct srpc_bulk *bk,unsigned int off, +unsigned int bulk_npg,unsigned int bulk_len,int sink); +void srpc_send_rpc (struct swi_workitem *wi);int srpc_send_reply (struct srpc_server_rpc *rpc);int srpc_add_service (struct srpc_service *sv);
@@ -605,7 +611,6 @@ struct srpc_bulk *srpc_alloc_bulk(int cpt, unsigned int off, }extern struct sfw_test_client_ops brw_test_client; -void brw_init_test_client (void );extern struct srpc_service brw_test_service;void brw_init_test_service (void );
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 11/24 lnet: change ni_status in lnet_ni to u32*
In reply to James SimmonsFrom: Mr NeilBrown <[email protected]>
struct lnet_ni.ni_status points to a 'struct lnet_ni_status', but only the ns_status field of that structure is ever accessed.
Change ni_status to point directly to just the ns_status field. This will provide flexibility for introducing a variant for 'struct lnet_ni_status' which holds a large-address nid.
WC-bug-id: https://jira.whamcloud.com/browse/LU-10391
Lustre-commit: 9e2df7e5cc5fca3c6 ("LU-10391 lnet: change ni_status in lnet_ni to u32*")
Reviewed-on: https://review.whamcloud.com/44626
--- include/linux/lnet/lib-lnet.h | 8 ++++---- include/linux/lnet/lib-types.h | 2 +- net/lnet/lnet/api-ni.c | 2 +- net/lnet/lnet/router.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-)
include/linux/lnet/lib-lnet.h +4 -4
@@ -108,11 +108,11 @@ {bool update = false; -if (ni->ni_status && ni->ni_status->ns_status != status) { +if (ni->ni_status && *ni->ni_status != status) {CDEBUG (D_NET ,"ni %s status changed from %#x to %#x\n" ,libcfs_nidstr (&ni->ni_nid), - ni->ni_status->ns_status, status); - ni->ni_status->ns_status = status; + *ni->ni_status, status); + *ni->ni_status = status; update = true; }
@@ -128,7 +128,7 @@else if (atomic_read (&ni->ni_fatal_error_on))return LNET_NI_STATUS_DOWN ;else if (ni->ni_status) -return ni->ni_status->ns_status; +return *ni->ni_status;else return LNET_NI_STATUS_UP ; }
include/linux/lnet/lib-types.h +1 -1
@@ -500,7 +500,7 @@ struct lnet_ni {struct lnet_net *ni_net;/* my health status */ -struct lnet_ni_status *ni_status; +u32 *ni_status;/* NI FSM. Protected by lnet_ni_lock() */ enum lnet_ni_state ni_state;
net/lnet/lnet/api-ni.c +1 -1
@@ -1967,7 +1967,7 @@ struct lnet_ping_buffer *lnet_ni_lock (ni); ns->ns_status =lnet_ni_get_status_locked (ni); - ni->ni_status = ns; + ni->ni_status = &ns->ns_status;lnet_ni_unlock (ni); i++;
net/lnet/lnet/router.c +1 -1
@@ -1082,7 +1082,7 @@ int lnet_get_rtr_pool_cfg(int cpt, struct lnet_ioctl_pool_cfg *pool_cfg)*/ if (atomic_read (&ni->ni_fatal_error_on) && ni->ni_status && - ni->ni_status->ns_status !=LNET_NI_STATUS_DOWN && + *ni->ni_status !=LNET_NI_STATUS_DOWN &&lnet_ni_set_status (ni,LNET_NI_STATUS_DOWN )) push = true; }
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 12/24 lustre: llite: Rework upper/lower DIO/AIO
In reply to James SimmonsFrom: Patrick Farrell <[email protected]>
One of the patches for LU-13799,
"Implement lower/upper aio"
(https://review.whamcloud.com/44209/) created a complicated setup where the cl_dio_aio struct was used both for the top level DIO or AIO and for the lower level sub I/Os (corresponding to stripes).
This is quite complicated and hard to follow, so this rewrites these two uses to be separate structs. This incidentally fixes at least one possible memory leak, but is mostly a cleanup.
WC-bug-id: https://jira.whamcloud.com/browse/LU-15811
Lustre-commit: 51c18539338f1a23f ("LU-15811 llite: Rework upper/lower DIO/AIO")
Reviewed-on: https://review.whamcloud.com/47187
--- fs/lustre/include/cl_object.h | 41 ++++++++----- fs/lustre/llite/file.c | 37 ++++++----- fs/lustre/llite/rw26.c | 83 +++++++++++++------------ fs/lustre/obdclass/cl_internal.h | 1 + fs/lustre/obdclass/cl_io.c | 129 ++++++++++++++++++++++----------------- fs/lustre/obdclass/cl_object.c | 6 ++ 6 files changed, 175 insertions(+), 122 deletions(-)
fs/lustre/include/cl_object.h +27 -14
@@ -1788,8 +1788,8 @@ struct cl_io {enum cl_io_state ci_state;/** main object this io is against. Immutable after creation. */ struct cl_object *ci_obj; -/** one AIO request might be split in cl_io_loop */ -struct cl_dio_aio *ci_aio; +/** top level dio_aio */ +struct cl_dio_aio *ci_dio_aio;/** * Upper layer io, of which this io is a part of. Immutable after * creation.
@@ -2532,11 +2532,12 @@ void cl_req_attr_set(const struct lu_env *env, struct cl_object *obj,struct cl_sync_io ;struct cl_dio_aio ; +struct cl_sub_dio ;typedef void (cl_sync_io_end_t )(const struct lu_env *,struct cl_sync_io *); -void cl_sync_io_init_notify (struct cl_sync_io *anchor,int nr, -struct cl_dio_aio *aio,cl_sync_io_end_t *end); +void cl_sync_io_init_notify (struct cl_sync_io *anchor,int nr,void *dio_aio, +cl_sync_io_end_t *end);int cl_sync_io_wait (const struct lu_env *env,struct cl_sync_io *anchor,long timeout);
@@ -2544,9 +2545,12 @@ void cl_sync_io_note(const struct lu_env *env, struct cl_sync_io *anchor, int ioret);int cl_sync_io_wait_recycle (const struct lu_env *env,struct cl_sync_io *anchor,long timeout,int ioret); -struct cl_dio_aio *cl_aio_alloc (struct kiocb *iocb,struct cl_object *obj, -struct cl_dio_aio *ll_aio); -void cl_aio_free (const struct lu_env *env,struct cl_dio_aio *aio); +struct cl_dio_aio *cl_dio_aio_alloc (struct kiocb *iocb,struct cl_object *obj, +bool is_aio); +struct cl_sub_dio *cl_sub_dio_alloc (struct cl_dio_aio *ll_aio,bool nofree); +void cl_dio_aio_free (const struct lu_env *env,struct cl_dio_aio *aio, +bool always_free); +void cl_sub_dio_free (struct cl_sub_dio *sdio,bool nofree);static inline void cl_sync_io_init (struct cl_sync_io *anchor,int nr) {
@@ -2568,8 +2572,8 @@ struct cl_sync_io {wait_queue_head_t csi_waitq;/** callback to invoke when this IO is finished */ cl_sync_io_end_t *csi_end_io; -/** aio private data */ -struct cl_dio_aio *csi_aio; +/* private pointer for an associated DIO/AIO */ +void *csi_dio_aio; };
@@ -2587,17 +2591,26 @@ struct ll_dio_pages {loff_t ldp_file_offset; }; -/* To support Direct AIO */ +/* Top level struct used for AIO and DIO */ struct cl_dio_aio {struct cl_sync_io cda_sync; -struct cl_page_list cda_pages;struct cl_object *cda_obj;struct kiocb *cda_iocb;ssize_t cda_bytes; -struct cl_dio_aio *cda_ll_aio; -struct ll_dio_pages cda_dio_pages;unsigned int cda_no_aio_complete:1 , - cda_no_aio_free:1 ; + cda_no_sub_free:1 ; +}; + +/* Sub-dio used for splitting DIO (and AIO, because AIO is DIO) according to +* the layout/striping, so we can do parallel submit of DIO RPCs +*/ +struct cl_sub_dio { +struct cl_sync_io csd_sync; +struct cl_page_list csd_pages; +ssize_t csd_bytes; +struct cl_dio_aio *csd_ll_aio; +struct ll_dio_pages csd_dio_pages; +unsigned int csd_no_free:1 ; };void ll_release_user_pages (struct page **pages,int npages);
fs/lustre/llite/file.c +22 -15
@@ -1664,7 +1664,7 @@ static void ll_heat_add(struct inode *inode, enum cl_io_type iot,unsigned int dio_lock =0 ;bool is_aio = false;bool is_parallel_dio = false; -struct cl_dio_aio *ci_aio =NULL ; +struct cl_dio_aio *ci_dio_aio =NULL ;size_t per_bytes;bool partial_io = false;size_t max_io_pages, max_cached_pages;
@@ -1694,9 +1694,10 @@ static void ll_heat_add(struct inode *inode, enum cl_io_type iot,if (!ll_sbi_has_parallel_dio (sbi)) is_parallel_dio = false; - ci_aio =cl_aio_alloc (args->u.normal.via_iocb, -ll_i2info (inode)->lli_clob,NULL ); -if (!ci_aio) { + ci_dio_aio =cl_dio_aio_alloc (args->u.normal.via_iocb, +ll_i2info (inode)->lli_clob, + is_aio); +if (!ci_dio_aio) { rc = -ENOMEM ; goto out; }
@@ -1715,7 +1716,7 @@ static void ll_heat_add(struct inode *inode, enum cl_io_type iot, partial_io = per_bytes < count; io =vvp_env_thread_io (env);ll_io_init (io, file, iot ==CIT_WRITE , args); - io->ci_aio = ci_aio; + io->ci_dio_aio = ci_dio_aio; io->ci_dio_lock = dio_lock; io->ci_ndelay_tried = retried; io->ci_parallel_dio = is_parallel_dio;
@@ -1762,12 +1763,8 @@ static void ll_heat_add(struct inode *inode, enum cl_io_type iot, rc = io->ci_result; } -/* N/B: parallel DIO may be disabled during i/o submission; -* if that occurs, async RPCs are resolved before we get here, and this -* wait call completes immediately. -*/ if (is_parallel_dio) { -struct cl_sync_io *anchor = &io->ci_aio->cda_sync; +struct cl_sync_io *anchor = &io->ci_dio_aio->cda_sync;/* for dio, EIOCBQUEUED is an implementation detail, * and we don't return it to userspace
@@ -1775,6 +1772,11 @@ static void ll_heat_add(struct inode *inode, enum cl_io_type iot,if (rc == -EIOCBQUEUED ) rc =0 ; +/* N/B: parallel DIO may be disabled during i/o submission; +* if that occurs, I/O shifts to sync, so it's all resolved +* before we get here, and this wait call completes +* immediately. +*/ rc2 =cl_sync_io_wait_recycle (env, anchor,0 ,0 );if (rc2 <0 ) rc = rc2;
@@ -1838,24 +1840,29 @@ static void ll_heat_add(struct inode *inode, enum cl_io_type iot, goto restart; } -if (io->ci_aio) { +if (io->ci_dio_aio) {/* * VFS will call aio_complete() if no -EIOCBQUEUED * is returned for AIO, so we can not call aio_complete() * in our end_io(). +* +* NB: This is safe because the atomic_dec_and_lock in +* cl_sync_io_init has implicit memory barriers, so this will +* be seen by whichever thread completes the DIO/AIO, even if +* it's not this one */ if (rc != -EIOCBQUEUED ) - io->ci_aio->cda_no_aio_complete =1 ; + io->ci_dio_aio->cda_no_aio_complete =1 ;/** * Drop one extra reference so that end_io() could be * called for this IO context, we could call it after * we make sure all AIO requests have been proceed. */ -cl_sync_io_note (env, &io->ci_aio->cda_sync, +cl_sync_io_note (env, &io->ci_dio_aio->cda_sync, rc == -EIOCBQUEUED ?0 : rc);if (!is_aio) { -cl_aio_free (env, io->ci_aio); - io->ci_aio =NULL ; +cl_dio_aio_free (env, io->ci_dio_aio, true); + io->ci_dio_aio =NULL ; } }
fs/lustre/llite/rw26.c +45 -38
152 lines not on this page · raw message
fs/lustre/obdclass/cl_internal.h +1 -0
@@ -47,6 +47,7 @@ struct cl_thread_info { };extern struct kmem_cache *cl_dio_aio_kmem; +extern struct kmem_cache *cl_sub_dio_kmem;extern struct kmem_cache *cl_page_kmem_array[16 ];extern unsigned short cl_page_kmem_size_array[16 ];
fs/lustre/obdclass/cl_io.c +74 -55
210 lines not on this page · raw message
fs/lustre/obdclass/cl_object.c +6 -0
@@ -57,6 +57,7 @@static struct kmem_cache *cl_env_kmem;struct kmem_cache *cl_dio_aio_kmem; +struct kmem_cache *cl_sub_dio_kmem;struct kmem_cache *cl_page_kmem_array[16 ];unsigned short cl_page_kmem_size_array[16 ];
@@ -989,6 +990,11 @@ struct cl_thread_info *cl_env_info(const struct lu_env *env) .ckd_size = sizeof(struct cl_dio_aio) }, { + .ckd_cache = &cl_sub_dio_kmem, + .ckd_name = "cl_sub_dio_kmem", + .ckd_size = sizeof(struct cl_sub_dio) + }, + { .ckd_cache = NULL } };
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 13/24 lustre: sec: use enc pool for bounce pages
In reply to James SimmonsFrom: Sebastien Buisson <[email protected]>
Take pages from the enc pool so that they can be used for encryption, instead of letting fscrypt allocate a bounce page for every call to the encryption primitives.
Pages are taken from the enc pool a whole array at a time.
This requires modifying the fscrypt API, so that new functions fscrypt_encrypt_block() and fsrypt_decrypt_block() are exported. These functions take a destination page parameter.
Using enc pool for bounce pages is a worthwhile performance win. Here are performance penalties incurred by encryption, without this patch, and with this patch:
||=====================|=====================||
|| Performance penalty | Performance penalty ||
|| without patch | with patch ||
||==========================================|=====================||
|| Bandwidth – write | 30%-35% | 5%-10% large IOs ||
|| | | 15% small IOs ||
||------------------------------------------|---------------------||
|| Bandwidth – read | 20% | less than 10% ||
||------------------------------------------|---------------------||
|| Metadata | N/A | 5% ||
|| creat,stat,remove | | ||
||==========================================|=====================||WC-bug-id: https://jira.whamcloud.com/browse/LU-15003
Lustre-commit: f3fe144b8572e9e75b ("LU-15003 sec: use enc pool for bounce pages")
Reviewed-on: https://review.whamcloud.com/47149
--- fs/crypto/crypto.c | 34 ++-- fs/lustre/include/lustre_sec.h | 3 + fs/lustre/llite/dir.c | 5 +- fs/lustre/osc/osc_request.c | 134 +++++++++++- fs/lustre/ptlrpc/sec_bulk.c | 452 +++++++++++++++++++++++++++++++++++++++-- include/linux/fscrypt.h | 49 ++++- 6 files changed, 632 insertions(+), 45 deletions(-)
fs/crypto/crypto.c +19 -15
@@ -202,9 +202,10 @@ struct page *fscrypt_encrypt_pagecache_blocks(struct page *page,EXPORT_SYMBOL (fscrypt_encrypt_pagecache_blocks);/** -* fscrypt_encrypt_block_inplace() - Encrypt a filesystem block in-place +* fscrypt_encrypt_block() - Cache an encrypted filesystem block in a page * @inode: The inode to which this block belongs -* @page: The page containing the block to encrypt +* @src: The page containing the block to encrypt +* @dst: The page which will contain the encrypted data * @len: Size of block to encrypt. Doesn't need to be a multiple of the * fs block size, but must be a multiple of FS_CRYPTO_BLOCK_SIZE. * @offs: Byte offset within @page at which the block to encrypt begins
@@ -215,17 +216,18 @@ struct page *fscrypt_encrypt_pagecache_blocks(struct page *page,* Encrypt a possibly-compressed filesystem block that is located in an * arbitrary page, not necessarily in the original pagecache page. The @inode * and @lblk_num must be specified, as they can't be determined from @page. +* The decrypted data will be stored in @dst. * * Return: 0 on success; -errno on failure */ -int fscrypt_encrypt_block_inplace (const struct inode *inode,struct page *page, -unsigned int len,unsigned int offs, -u64 lblk_num,gfp_t gfp_flags) +int fscrypt_encrypt_block (const struct inode *inode,struct page *src, +struct page *dst,unsigned int len,unsigned int offs, +u64 lblk_num,gfp_t gfp_flags) { -return fscrypt_crypt_block (inode,FS_ENCRYPT , lblk_num, page, page, +return fscrypt_crypt_block (inode,FS_ENCRYPT , lblk_num, src, dst, len, offs, gfp_flags); } -EXPORT_SYMBOL (fscrypt_encrypt_block_inplace); +EXPORT_SYMBOL (fscrypt_encrypt_block);/** * fscrypt_decrypt_pagecache_blocks() - Decrypt filesystem blocks in a
@@ -272,9 +274,10 @@ int fscrypt_decrypt_pagecache_blocks(struct page *page, unsigned int len,EXPORT_SYMBOL (fscrypt_decrypt_pagecache_blocks);/** -* fscrypt_decrypt_block_inplace() - Decrypt a filesystem block in-place +* fscrypt_decrypt_block() - Cache a decrypted a filesystem block in a page * @inode: The inode to which this block belongs -* @page: The page containing the block to decrypt +* @src: The page containing the block to decrypt +* @dst: The page which will contain the plain data * @len: Size of block to decrypt. Doesn't need to be a multiple of the * fs block size, but must be a multiple of FS_CRYPTO_BLOCK_SIZE. * @offs: Byte offset within @page at which the block to decrypt begins
@@ -284,17 +287,18 @@ int fscrypt_decrypt_pagecache_blocks(struct page *page, unsigned int len,* Decrypt a possibly-compressed filesystem block that is located in an * arbitrary page, not necessarily in the original pagecache page. The @inode * and @lblk_num must be specified, as they can't be determined from @page. +* The encrypted data will be stored in @dst. * * Return: 0 on success; -errno on failure */ -int fscrypt_decrypt_block_inplace (const struct inode *inode,struct page *page, -unsigned int len,unsigned int offs, -u64 lblk_num) +int fscrypt_decrypt_block (const struct inode *inode,struct page *src, +struct page *dst,unsigned int len,unsigned int offs, +u64 lblk_num,gfp_t gfp_flags) { -return fscrypt_crypt_block (inode,FS_DECRYPT , lblk_num, page, page, - len, offs,GFP_NOFS ); +return fscrypt_crypt_block (inode,FS_DECRYPT , lblk_num, src, dst, + len, offs, gfp_flags); } -EXPORT_SYMBOL (fscrypt_decrypt_block_inplace); +EXPORT_SYMBOL (fscrypt_decrypt_block);/** * fscrypt_initialize() - allocate major buffers for fs encryption.
fs/lustre/include/lustre_sec.h +3 -0
@@ -1048,6 +1048,9 @@ int sptlrpc_target_export_check(struct obd_export *exp, struct ptlrpc_request *req);/* bulk security api */ +int sptlrpc_enc_pool_add_user (void ); +int sptlrpc_enc_pool_get_pages_array (struct page **pa,unsigned int count); +void sptlrpc_enc_pool_put_pages_array (struct page **pa,unsigned int count);void sptlrpc_enc_pool_put_pages (struct ptlrpc_bulk_desc *desc);int get_free_pages_in_pool (void );int pool_is_at_full_capacity (void );
fs/lustre/llite/dir.c +4 -1
@@ -2292,7 +2292,10 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)case FS_IOC_ADD_ENCRYPTION_KEY :if (!ll_sbi_has_encrypt (ll_i2sbi (inode)))return -EOPNOTSUPP ; -return fscrypt_ioctl_add_key (file, (void __user *)arg); + rc =fscrypt_ioctl_add_key (file, (void __user *)arg); +if (!rc) +sptlrpc_enc_pool_add_user (); +return rc;case FS_IOC_REMOVE_ENCRYPTION_KEY :if (!ll_sbi_has_encrypt (ll_i2sbi (inode)))return -EOPNOTSUPP ;
fs/lustre/osc/osc_request.c +130 -4
176 lines not on this page · raw message
fs/lustre/ptlrpc/sec_bulk.c +433 -19
496 lines not on this page · raw message
include/linux/fscrypt.h +43 -6
70 lines not on this page · raw message
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 14/24 lustre: llite: Unify range unlock
In reply to James SimmonsFrom: Patrick Farrell <[email protected]>
Correct parallel_dio condition and unify range unlock code block.
WC-bug-id: https://jira.whamcloud.com/browse/LU-15811
Lustre-commit: 36c34af60767bd5da ("LU-15811 llite: Unify range unlock")
Reviewed-on: https://review.whamcloud.com/48000
--- fs/lustre/llite/file.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-)
fs/lustre/llite/file.c +8 -13
@@ -1750,20 +1750,12 @@ static void ll_heat_add(struct inode *inode, enum cl_io_type iot,ll_cl_add (inode, env, io,LCC_RW ); rc =cl_io_loop (env, io);ll_cl_remove (inode, env); - -if (range_locked && !is_parallel_dio) { -CDEBUG (D_VFSTRACE ,"Range unlock [%llu, %llu]\n" , - range.rl_start, - range.rl_last); -range_unlock (&lli->lli_write_tree, &range); - range_locked = false; - } }else {/* cl_io_rw_init() handled IO */ rc = io->ci_result; } -if (is_parallel_dio) { +if (io->ci_dio_aio && !is_aio) {struct cl_sync_io *anchor = &io->ci_dio_aio->cda_sync;/* for dio, EIOCBQUEUED is an implementation detail,
@@ -1780,11 +1772,14 @@ static void ll_heat_add(struct inode *inode, enum cl_io_type iot, rc2 =cl_sync_io_wait_recycle (env, anchor,0 ,0 );if (rc2 <0 ) rc = rc2; + } -if (range_locked) { -range_unlock (&lli->lli_write_tree, &range); - range_locked = false; - } +if (range_locked) { +CDEBUG (D_VFSTRACE ,"Range lock [%llu, %llu]\n" , + range.rl_start, + range.rl_last); +range_unlock (&lli->lli_write_tree, &range); + range_locked = false; }/*
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 15/24 lustre: llite: Refactor DIO/AIO free code
In reply to James SimmonsFrom: Patrick Farrell <[email protected]>
Refactor the DIO/AIO free code and add some asserts.
This removes a potential use-after-free in the freeing code.
WC-bug-id: https://jira.whamcloud.com/browse/LU-15811
Lustre-commit: f1c8ac1156ebea2b8 ("LU-15811 llite: Refactor DIO/AIO free code")
Reviewed-on: https://review.whamcloud.com/48115
--- fs/lustre/include/cl_object.h | 11 +++++----- fs/lustre/llite/file.c | 3 ++- fs/lustre/llite/rw26.c | 9 ++++++--- fs/lustre/obdclass/cl_io.c | 47 ++++++++++++++++++++++++++----------------- 4 files changed, 41 insertions(+), 29 deletions(-)
fs/lustre/include/cl_object.h +5 -6
@@ -2547,10 +2547,9 @@ int cl_sync_io_wait_recycle(const struct lu_env *env, struct cl_sync_io *anchor, long timeout, int ioret);struct cl_dio_aio *cl_dio_aio_alloc (struct kiocb *iocb,struct cl_object *obj,bool is_aio); -struct cl_sub_dio *cl_sub_dio_alloc (struct cl_dio_aio *ll_aio,bool nofree); -void cl_dio_aio_free (const struct lu_env *env,struct cl_dio_aio *aio, -bool always_free); -void cl_sub_dio_free (struct cl_sub_dio *sdio,bool nofree); +struct cl_sub_dio *cl_sub_dio_alloc (struct cl_dio_aio *ll_aio,bool sync); +void cl_dio_aio_free (const struct lu_env *env,struct cl_dio_aio *aio); +void cl_sub_dio_free (struct cl_sub_dio *sdio);static inline void cl_sync_io_init (struct cl_sync_io *anchor,int nr) {
@@ -2598,7 +2597,7 @@ struct cl_dio_aio {struct kiocb *cda_iocb;ssize_t cda_bytes; unsigned int cda_no_aio_complete:1, - cda_no_sub_free:1; + cda_creator_free:1; };/* Sub-dio used for splitting DIO (and AIO, because AIO is DIO) according to
@@ -2610,7 +2609,7 @@ struct cl_sub_dio {ssize_t csd_bytes;struct cl_dio_aio *csd_ll_aio;struct ll_dio_pages csd_dio_pages; - unsigned int csd_no_free:1; + unsigned int csd_creator_free:1; };void ll_release_user_pages (struct page **pages,int npages);
fs/lustre/llite/file.c +2 -1
@@ -1856,7 +1856,8 @@ static void ll_heat_add(struct inode *inode, enum cl_io_type iot,cl_sync_io_note (env, &io->ci_dio_aio->cda_sync, rc == -EIOCBQUEUED ?0 : rc);if (!is_aio) { -cl_dio_aio_free (env, io->ci_dio_aio, true); +LASSERT (io->ci_dio_aio->cda_creator_free); +cl_dio_aio_free (env, io->ci_dio_aio); io->ci_dio_aio =NULL ; } }
fs/lustre/llite/rw26.c +6 -3
@@ -391,8 +391,10 @@ static ssize_t ll_direct_IO(struct kiocb *iocb, struct iov_iter *iter) &pvec->ldp_count, count);if (unlikely (result <=0 )) {cl_sync_io_note (env, &ldp_aio->csd_sync, result); -if (sync_submit) -cl_sub_dio_free (ldp_aio, true); +if (sync_submit) { +LASSERT (ldp_aio->csd_creator_free); +cl_sub_dio_free (ldp_aio); + } goto out; }
@@ -412,7 +414,8 @@ static ssize_t ll_direct_IO(struct kiocb *iocb, struct iov_iter *iter) 0);if (result ==0 && rc2) result = rc2; -cl_sub_dio_free (ldp_aio, true); +LASSERT (ldp_aio->csd_creator_free); +cl_sub_dio_free (ldp_aio); }if (unlikely (result <0 )) goto out;
fs/lustre/obdclass/cl_io.c +28 -19
94 lines not on this page · raw message
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 16/24 lnet: Use fatal NI if none other available
In reply to James SimmonsFrom: Serguei Smirnov <[email protected]>
Allow NI in fatal state to be selected for sending if there are no NIs in non-fatal state.
HPE-bug-id: LUS-11019
WC-bug-id: https://jira.whamcloud.com/browse/LU-14955
Lustre-commit: ff3322fd0c77a8042 ("LU-14955 lnet: Use fatal NI if none other available")
Reviewed-on: https://review.whamcloud.com/44746
--- net/lnet/lnet/lib-move.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-)
net/lnet/lnet/lib-move.c +17 -5
@@ -1449,6 +1449,7 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats,int best_healthv;u32 best_sel_prio;unsigned int best_dev_prio; +int best_ni_fatal;unsigned int dev_idx =UINT_MAX ;bool gpu = md ? (md->md_flags &LNET_MD_FLAG_GPU ) : false;
@@ -1470,6 +1471,7 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats, best_dev_prio =UINT_MAX ; best_credits =INT_MIN ; best_healthv =0 ; + best_ni_fatal = true; }else { best_dev_prio =lnet_dev_prio_of_md (best_ni, dev_idx); shortest_distance = cfs_cpt_distance(lnet_cpt_table(), md_cpt,
@@ -1477,6 +1479,7 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats, best_credits =atomic_read (&best_ni->ni_tx_credits); best_healthv =atomic_read (&best_ni->ni_healthv); best_sel_prio = best_ni->ni_sel_priority; + best_ni_fatal =atomic_read (&best_ni->ni_fatal_error_on); }while ((ni =lnet_get_next_ni_locked (local_net, ni))) {
@@ -1510,7 +1513,7 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats,if (!gpu && distance < lnet_numa_range) distance = lnet_numa_range; -/* * Select on health, selection policy, direct dma prio, +/** Select on health, selection policy, direct dma prio, * shorter distance, available credits, then round-robin. */ if (ni_fatal)
@@ -1518,16 +1521,24 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats,if (best_ni)CDEBUG (D_NET , -"compare ni %s [c:%d, d:%d, s:%d, p:%u, g:%u, h:%d] with best_ni %s [c:%d, d:%d, s:%d, p:%u, g:%u, h:%d]\n" , -libcfs_nidstr (&ni->ni_nid), ni_credits, distance, +"compare ni %s [f:%s, c:%d, d:%d, s:%d, p:%u, g:%u, h:%d] with best_ni %s [f:%s, c:%d, d:%d, s:%d, p:%u, g:%u, h:%d]\n" , +libcfs_nidstr (&ni->ni_nid), + ni_fatal ?"y" :"n" , ni_credits, distance, ni->ni_seq, ni_sel_prio, ni_dev_prio, ni_healthv, - (best_ni) ?libcfs_nidstr (&best_ni->ni_nid) - :"not selected" , best_credits, shortest_distance, + (best_ni) ?libcfs_nidstr (&best_ni->ni_nid) : +"not selected" , + best_ni_fatal ?"y" :"n" , best_credits, + shortest_distance, (best_ni) ? best_ni->ni_seq :0 , best_sel_prio, best_dev_prio, best_healthv);else goto select_ni; +if (ni_fatal && !best_ni_fatal) +continue ; +else if (!ni_fatal && best_ni_fatal) + goto select_ni; +if (ni_healthv < best_healthv)continue ;else if (ni_healthv > best_healthv)
@@ -1563,6 +1574,7 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats, best_healthv = ni_healthv; best_ni = ni; best_credits = ni_credits; + best_ni_fatal = ni_fatal; } CDEBUG(D_NET, "selected best_ni %s\n",
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 17/24 lnet: LNet peer aliveness broken
In reply to James SimmonsFrom: Chris Horn <[email protected]>
The peer health feature used on LNet routers is intended to detect if a peer is dead or alive by keeping track of the last time it received a message from the peer. If the last alive value is outside of a configurable interval then the peer is considered dead and the router will drop messages to that peer rather than attempt to send to it.
This feature no longer works as intended because even if the last alive value is outside the interval the router will still consider the peer NI to be alive if the health value of the NI and the cached status both indicate the peer NI is alive.
So even if a router has not received any messages from the client in days, as long as the router thinks the peer's interfaces are healthy then it will consider the peer alive. This doesn't make any sense as peers are supposed to regularly ping the router, and if they don't do so then they should not be considered alive.
Fix the issue by relying solely on the last alive value to determine peer aliveness. Do not consider the health value or cached status when determining whether to drop the message.
lnet_peer_alive_locked() has single caller that only checks whether zero was returned. We can convert lnet_peer_alive_locked() to return bool rather than int.
Rename lnet_peer_alive_locked() to lnet_check_message_drop() to better reflect the purpose of the function. The return value is inverted to reflect the name change.
WC-bug-id: https://jira.whamcloud.com/browse/LU-15595
Lustre-commit: caf6095ade66f70d4 ("LU-15595 lnet: LNet peer aliveness broken")
Reviewed-on: https://review.whamcloud.com/46623
--- net/lnet/lnet/lib-move.c | 51 +++++++++++++++--------------------------------- 1 file changed, 16 insertions(+), 35 deletions(-)
net/lnet/lnet/lib-move.c +16 -35
@@ -572,55 +572,37 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats,return rc; } +/* returns true if this message should be dropped */ static bool -lnet_is_peer_deadline_passed (struct lnet_peer_ni *lpni,time64_t now) +lnet_check_message_drop (struct lnet_ni *ni,struct lnet_peer_ni *lpni, +struct lnet_msg *msg) { -time64_t deadline; - - deadline = lpni->lpni_last_alive + - lpni->lpni_net->net_tunables.lct_peer_timeout; - -/* assume peer_ni is alive as long as we're within the configured -* peer timeout -*/ -if (deadline > now) +if (msg->msg_target.pid &LNET_PID_USERFLAG )return false; -return true; -} - -/* -* NB: returns 1 when alive, 0 when dead, negative when error; -* may drop the lnet_net_lock -*/ -static int -lnet_peer_alive_locked (struct lnet_ni *ni,struct lnet_peer_ni *lpni, -struct lnet_msg *msg) -{ -time64_t now =ktime_get_seconds (); -if (!lnet_peer_aliveness_enabled (lpni)) -return -ENODEV ; +return false; -/* -* If we're resending a message, let's attempt to send it even if +/* If we're resending a message, let's attempt to send it even if * the peer is down to fulfill our resend quota on the message */ if (msg->msg_retry_count >0 ) -return 1 ; +return false;/* try and send recovery messages irregardless */ if (msg->msg_recovery) -return 1 ; +return false;/* always send any responses */ if (lnet_msg_is_response (msg)) -return 1 ; - -if (!lnet_is_peer_deadline_passed (lpni, now)) -return true; +return false; -return lnet_is_peer_ni_alive (lpni); +/* assume peer_ni is alive as long as we're within the configured +* peer timeout +*/ +return ktime_get_seconds () >= + (lpni->lpni_last_alive + + lpni->lpni_net->net_tunables.lct_peer_timeout); }/**
@@ -653,8 +635,7 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats,LASSERT (!nid_same (&lp->lpni_nid, &the_lnet.ln_loni->ni_nid));/* NB 'lp' is always the next hop */ -if (!(msg->msg_target.pid &LNET_PID_USERFLAG ) && - !lnet_peer_alive_locked (ni, lp, msg)) { +if (lnet_check_message_drop (ni, lp, msg)) { the_lnet.ln_counters[cpt]->lct_common.lcc_drop_count++; the_lnet.ln_counters[cpt]->lct_common.lcc_drop_length += msg->msg_len;
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 18/24 lnet: Correct net selection for router ping
In reply to James SimmonsFrom: Chris Horn <[email protected]>
lnet_find_best_ni_on_local_net() contains logic for restricting the NI selection to a net specified by lnet_peer::lp_disc_net_id. The purpose of this is to ensure that LNet peers ping every interface on a router at a regular interval as part of the LNet router health feature. However, this logic is flawed because lnet_msg_discovery() is used to determine whether the message being sent is a discovery message, but that function actually determines whether a given message can _trigger_ discovery.
Introduce a new function, lnet_msg_is_ping(), which determines whether a given lnet_msg is a GET on the LNET_RESERVED_PORTAL. Modify lnet_find_best_ni_on_local_net() to restrict NI selection to lp_disc_net_id iff:
1. lp_disc_net_id is non-zero
2. The peer has the LNET_PEER_RTR_DISCOVERY flag set.
3. lnet_msg_is_ping() returns true
HPE-bug-id: LUS-11017
WC-bug-id: https://jira.whamcloud.com/browse/LU-15929
Lustre-commit: 2431e099b143a4c7e ("LU-15929 lnet: Correct net selection for router ping")
Reviewed-on: https://review.whamcloud.com/47527
--- net/lnet/lnet/lib-move.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-)
net/lnet/lnet/lib-move.c +21 -4
@@ -1577,7 +1577,8 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats,return false; } -/* +/* Can the specified message trigger peer discovery? +* * Traffic to the LNET_RESERVED_PORTAL may not trigger peer discovery, * because such traffic is required to perform discovery. We therefore * exclude all GET and PUT on that portal. We also exclude all ACK and
@@ -1591,6 +1592,18 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats,return !(lnet_reserved_msg (msg) ||lnet_msg_is_response (msg)); } +/* Is the specified message an LNet ping? +*/ +static bool +lnet_msg_is_ping (struct lnet_msg *msg) +{ +if (msg->msg_type ==LNET_MSG_GET && + msg->msg_hdr.msg.get.ptl_index ==LNET_RESERVED_PORTAL ) +return true; + +return false; +} +#define SRC_SPEC 0x0001#define SRC_ANY 0x0002#define LOCAL_DST 0x0004
@@ -2228,10 +2241,14 @@ struct lnet_ni *u32 best_net_sel_prio =LNET_MAX_SELECTION_PRIORITY ;u32 net_sel_prio; -/* if this is a discovery message and lp_disc_net_id is -* specified then use that net to send the discovery on. +/* If lp_disc_net_id is set, this peer is a router undergoing +* discovery, and this message is an LNet ping, then this may be a +* discovery message and we need to select an NI on the peer net +* specified by lp_disc_net_id */ -if (discovery && peer->lp_disc_net_id) { +if (peer->lp_disc_net_id && + (peer->lp_state &LNET_PEER_RTR_DISCOVERY ) && +lnet_msg_is_ping (msg)) { best_lpn =lnet_peer_get_net_locked (peer, peer->lp_disc_net_id);if (best_lpn &&lnet_get_net_locked (best_lpn->lpn_net_id)) goto select_best_ni;
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 19/24 lnet: Remove duplicate checks for peer sensitivity
In reply to James SimmonsFrom: Chris Horn <[email protected]>
Callers of lnet_inc_lpni_healthv_locked() and lnet_dec_healthv_locked() currently check whether the parent peer has a peer specific sensitivity defined. To remove this code duplication, this logic is rolled into lnet_inc_lpni_healthv_locked() and lnet_dec_lpni_healthv_locked(). The latter is a new wrapper around lnet_dec_healthv_locked().
lnet_dec_healthv_locked() is changed to return a bool indicating whether the health value was actually modified so that the peer net health is only updated when the peer NI health actually changes.
HPE-bug-id: LUS-11018
WC-bug-id: https://jira.whamcloud.com/browse/LU-15930
Lustre-commit: 84b1ca8618129d4e3 ("LU-15930 lnet: Remove duplicate checks for peer sensitivity")
Reviewed-on: https://review.whamcloud.com/46626
--- include/linux/lnet/lib-lnet.h | 44 +++++++++++++++++++++++++++++++++++++++---- net/lnet/lnet/lib-msg.c | 37 ++---------------------------------- net/lnet/lnet/router.c | 9 +-------- 3 files changed, 43 insertions(+), 47 deletions(-)
include/linux/lnet/lib-lnet.h +40 -4
@@ -1108,13 +1108,49 @@ int lnet_get_peer_ni_info(u32 peer_index, u64 *nid,return mod; } +static bool +lnet_dec_healthv_locked (atomic_t *healthv,int sensitivity) +{ +int h =atomic_read (healthv); + +if (h ==0 ) +return false; + +if (h < sensitivity) + h =0 ; +else + h -= sensitivity; + +return (atomic_xchg (healthv, h) != h); +} +static inline void -lnet_inc_lpni_healthv_locked (struct lnet_peer_ni *lpni,int value) +lnet_dec_lpni_healthv_locked (struct lnet_peer_ni *lpni) { -/* only adjust the net health if the lpni health value changed */ -if (lnet_atomic_add_unless_max (&lpni->lpni_healthv, value, -LNET_MAX_HEALTH_VALUE )) +/* If there is a health sensitivity in the peer then use that +* instead of the globally set one. +* only adjust the net health if the lpni health value changed +*/ +if (lnet_dec_healthv_locked (&lpni->lpni_healthv, + lpni->lpni_peer_net->lpn_peer->lp_health_sensitivity ? : + lnet_health_sensitivity)) {lnet_update_peer_net_healthv (lpni); + } +} + +static inline void +lnet_inc_lpni_healthv_locked (struct lnet_peer_ni *lpni) +{ +/* If there is a health sensitivity in the peer then use that +* instead of the globally set one. +* only adjust the net health if the lpni health value changed +*/ +if (lnet_atomic_add_unless_max (&lpni->lpni_healthv, + lpni->lpni_peer_net->lpn_peer->lp_health_sensitivity ? : + lnet_health_sensitivity, +LNET_MAX_HEALTH_VALUE )) { +lnet_update_peer_net_healthv (lpni); + } } static inline void
net/lnet/lnet/lib-msg.c +2 -35
@@ -443,19 +443,6 @@return 0 ; } -static void -lnet_dec_healthv_locked (atomic_t *healthv,int sensitivity) -{ -int h =atomic_read (healthv); - -if (h < sensitivity) { -atomic_set (healthv,0 ); - }else { - h -= sensitivity; -atomic_set (healthv, h); - } -} -/* must hold net_lock/0 */ void lnet_ni_add_to_recoveryq_locked(struct lnet_ni *ni,
@@ -505,20 +492,7 @@void lnet_handle_remote_failure_locked (struct lnet_peer_ni *lpni) { -u32 sensitivity = lnet_health_sensitivity; -u32 lp_sensitivity; - -/* If there is a health sensitivity in the peer then use that -* instead of the globally set one. -*/ - lp_sensitivity = lpni->lpni_peer_net->lpn_peer->lp_health_sensitivity; -if (lp_sensitivity) - sensitivity = lp_sensitivity; - -lnet_dec_healthv_locked (&lpni->lpni_healthv, sensitivity); - -/* update the peer_net's health value */ -lnet_update_peer_net_healthv (lpni); +lnet_dec_lpni_healthv_locked (lpni);/* add the peer NI to the recovery queue if it's not already there * and it's health value is actually below the maximum. It's
@@ -914,14 +888,7 @@lnet_set_lpni_healthv_locked (lpni,LNET_MAX_HEALTH_VALUE ); }else { -struct lnet_peer *lpn_peer; -u32 sensitivity; - - lpn_peer = lpni->lpni_peer_net->lpn_peer; - sensitivity = lpn_peer->lp_health_sensitivity ? - lpn_peer->lp_health_sensitivity : - lnet_health_sensitivity; -lnet_inc_lpni_healthv_locked (lpni, sensitivity); +lnet_inc_lpni_healthv_locked (lpni);/* This peer NI may have previously aged out * of recovery. Now that we've received a * message from it, we can continue recovery
net/lnet/lnet/router.c +1 -8
@@ -1761,14 +1761,7 @@ bool lnet_router_checker_active(void)lnet_set_lpni_healthv_locked (lpni,LNET_MAX_HEALTH_VALUE ); }else { -struct lnet_peer *lpn_peer; -u32 sensitivity; - - lpn_peer = lpni->lpni_peer_net->lpn_peer; - sensitivity = lpn_peer->lp_health_sensitivity; -lnet_inc_lpni_healthv_locked (lpni, - (sensitivity) ? sensitivity : - lnet_health_sensitivity); +lnet_inc_lpni_healthv_locked (lpni); } }else if (reset) { lpni->lpni_ns_status =LNET_NI_STATUS_DOWN ;
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 20/24 lustre: obdclass: use consistent stats units
In reply to James SimmonsFrom: Andreas Dilger <[email protected]>
Use consistent stats units, since some were "usec" and others "usecs". Most stats already use LPROCFS_TYPE_* to encode type stats type, so use this to provide units for those stats, and only explicitly provide strings for the few stats that don't match the commonly-used units. This also reduces the number of repeat static strings in the modules.
WC-bug-id: https://jira.whamcloud.com/browse/LU-15642
Lustre-commit: b515c6ec2ab84598c ("LU-15642 obdclass: use consistent stats units")
Reviewed-on: https://review.whamcloud.com/46833
--- fs/lustre/include/lprocfs_status.h | 27 +++++++++++------- fs/lustre/ldlm/ldlm_pool.c | 34 ++++++++++++++-------- fs/lustre/ldlm/ldlm_resource.c | 3 +- fs/lustre/llite/lproc_llite.c | 31 ++++++++------------ fs/lustre/obdclass/lprocfs_status.c | 56 +++++++++++++++++++++++++++++++++---- fs/lustre/obdclass/lu_object.c | 17 ++++------- fs/lustre/ptlrpc/lproc_ptlrpc.c | 32 ++++++++++----------- 7 files changed, 122 insertions(+), 78 deletions(-)
fs/lustre/include/lprocfs_status.h +17 -10
@@ -126,18 +126,22 @@ struct rename_stats {* multiply per counter increment. */ -enum { +enum lprocfs_counter_config {LPROCFS_CNTR_EXTERNALLOCK =0x0001 ,LPROCFS_CNTR_AVGMINMAX =0x0002 ,LPROCFS_CNTR_STDDEV =0x0004 , -/* counter data type */ -LPROCFS_TYPE_REQS =0x0100 , +/* counter unit type */ +LPROCFS_TYPE_REQS =0x0000 ,/* default if config = 0 */ LPROCFS_TYPE_BYTES =0x0200 ,LPROCFS_TYPE_PAGES =0x0400 , -LPROCFS_TYPE_USEC =0x0800 , +LPROCFS_TYPE_LOCKS =0x0500 , +LPROCFS_TYPE_LOCKSPS =0x0600 , +LPROCFS_TYPE_SECS =0x0700 , +LPROCFS_TYPE_USECS =0x0800 , +LPROCFS_TYPE_MASK =0x0f00 , -LPROCFS_TYPE_LATENCY =LPROCFS_TYPE_USEC | +LPROCFS_TYPE_LATENCY =LPROCFS_TYPE_USECS |LPROCFS_CNTR_AVGMINMAX |LPROCFS_CNTR_STDDEV , LPROCFS_TYPE_BYTES_FULL = LPROCFS_TYPE_BYTES |
@@ -148,9 +152,9 @@ enum {#define LC_MIN_INIT ((~(u64)0) >> 1)struct lprocfs_counter_header { -unsigned int lc_config; -const char *lc_name;/* must be static */ -const char *lc_units;/* must be static */ +enum lprocfs_counter_config lc_config; +const char *lc_name;/* must be static */ +const char *lc_units;/* must be static */ };struct lprocfs_counter {
@@ -435,8 +439,11 @@ int ldebugfs_alloc_md_stats(struct obd_device *obd, unsigned int num_private_stats);void ldebugfs_free_md_stats (struct obd_device *obd);void lprocfs_counter_init (struct lprocfs_stats *stats,int index, -unsigned int conf,const char *name, -const char *units); +enum lprocfs_counter_config config, +const char *name); +void lprocfs_counter_init_units (struct lprocfs_stats *stats,int index, +enum lprocfs_counter_config config, +const char *name,const char *units);extern const struct file_operations lprocfs_stats_seq_fops;/* lprocfs_status.c */
fs/lustre/ldlm/ldlm_pool.c +22 -12
@@ -605,27 +605,37 @@ static int ldlm_pool_debugfs_init(struct ldlm_pool *pl) }lprocfs_counter_init (pl->pl_stats,LDLM_POOL_GRANTED_STAT , -LPROCFS_CNTR_AVGMINMAX ,"granted" ,"locks" ); +LPROCFS_CNTR_AVGMINMAX |LPROCFS_TYPE_LOCKS , +"granted" );lprocfs_counter_init (pl->pl_stats,LDLM_POOL_GRANT_STAT , -LPROCFS_CNTR_AVGMINMAX ,"grant" ,"locks" ); +LPROCFS_CNTR_AVGMINMAX |LPROCFS_TYPE_LOCKS , +"grant" );lprocfs_counter_init (pl->pl_stats,LDLM_POOL_CANCEL_STAT , -LPROCFS_CNTR_AVGMINMAX ,"cancel" ,"locks" ); +LPROCFS_CNTR_AVGMINMAX |LPROCFS_TYPE_LOCKS , +"cancel" );lprocfs_counter_init (pl->pl_stats,LDLM_POOL_GRANT_RATE_STAT , -LPROCFS_CNTR_AVGMINMAX ,"grant_rate" ,"locks/s" ); +LPROCFS_CNTR_AVGMINMAX |LPROCFS_TYPE_LOCKSPS , +"grant_rate" );lprocfs_counter_init (pl->pl_stats,LDLM_POOL_CANCEL_RATE_STAT , -LPROCFS_CNTR_AVGMINMAX ,"cancel_rate" ,"locks/s" ); +LPROCFS_CNTR_AVGMINMAX |LPROCFS_TYPE_LOCKSPS , +"cancel_rate" );lprocfs_counter_init (pl->pl_stats,LDLM_POOL_GRANT_PLAN_STAT , -LPROCFS_CNTR_AVGMINMAX ,"grant_plan" ,"locks/s" ); -lprocfs_counter_init (pl->pl_stats,LDLM_POOL_SLV_STAT , -LPROCFS_CNTR_AVGMINMAX ,"slv" ,"slv" ); +LPROCFS_CNTR_AVGMINMAX |LPROCFS_TYPE_LOCKSPS , +"grant_plan" ); +lprocfs_counter_init_units (pl->pl_stats,LDLM_POOL_SLV_STAT , +LPROCFS_CNTR_AVGMINMAX ,"slv" ,"lock.secs" );lprocfs_counter_init (pl->pl_stats,LDLM_POOL_SHRINK_REQTD_STAT , -LPROCFS_CNTR_AVGMINMAX ,"shrink_request" ,"locks" ); +LPROCFS_CNTR_AVGMINMAX |LPROCFS_TYPE_LOCKS , +"shrink_request" );lprocfs_counter_init (pl->pl_stats,LDLM_POOL_SHRINK_FREED_STAT , -LPROCFS_CNTR_AVGMINMAX ,"shrink_freed" ,"locks" ); +LPROCFS_CNTR_AVGMINMAX |LPROCFS_TYPE_LOCKS , +"shrink_freed" );lprocfs_counter_init (pl->pl_stats,LDLM_POOL_RECALC_STAT , -LPROCFS_CNTR_AVGMINMAX ,"recalc_freed" ,"locks" ); +LPROCFS_CNTR_AVGMINMAX |LPROCFS_TYPE_LOCKS , +"recalc_freed" );lprocfs_counter_init (pl->pl_stats,LDLM_POOL_TIMING_STAT , -LPROCFS_CNTR_AVGMINMAX ,"recalc_timing" ,"sec" ); +LPROCFS_CNTR_AVGMINMAX |LPROCFS_TYPE_SECS , +"recalc_timing" );debugfs_create_file ("stats" ,0644 , pl->pl_debugfs_entry, pl->pl_stats, &lprocfs_stats_seq_fops);
fs/lustre/ldlm/ldlm_resource.c +2 -1
@@ -455,7 +455,8 @@ static int ldlm_namespace_sysfs_register(struct ldlm_namespace *ns) }lprocfs_counter_init (ns->ns_stats,LDLM_NSS_LOCKS , -LPROCFS_CNTR_AVGMINMAX ,"locks" ,"locks" ); +LPROCFS_CNTR_AVGMINMAX |LPROCFS_TYPE_LOCKS , +"locks" );return err; }
fs/lustre/llite/lproc_llite.c +11 -20
@@ -36,6 +36,7 @@#include <obd_support.h> #include "llite_internal.h" +#include "lprocfs_status.h" #include "vvp_internal.h" static struct kobject *llite_kobj;
@@ -1772,9 +1773,9 @@ static void sbi_kobj_release(struct kobject *kobj) };static const struct llite_file_opcode { -u32 opcode; -u32 type; -const char *opname; +u32 lfo_opcode; +enum lprocfs_counter_config lfo_config; +const char *lfo_opname; } llite_opcode_table[LPROC_LL_FILE_OPCODES ] = {/* file operation */ {LPROC_LL_READ_BYTES ,LPROCFS_TYPE_BYTES_FULL ,"read_bytes" },
@@ -1790,8 +1791,7 @@ static void sbi_kobj_release(struct kobject *kobj) { LPROC_LL_LLSEEK, LPROCFS_TYPE_LATENCY, "seek" }, { LPROC_LL_FSYNC, LPROCFS_TYPE_LATENCY, "fsync" }, { LPROC_LL_READDIR, LPROCFS_TYPE_LATENCY, "readdir" }, - { LPROC_LL_INODE_OCOUNT, LPROCFS_TYPE_REQS | -LPROCFS_CNTR_AVGMINMAX | + { LPROC_LL_INODE_OCOUNT, LPROCFS_TYPE_REQS | LPROCFS_CNTR_AVGMINMAX | LPROCFS_CNTR_STDDEV, "opencount" }, { LPROC_LL_INODE_OPCLTM, LPROCFS_TYPE_LATENCY, "openclosetime" }, /* inode operation */
@@ -1893,20 +1893,11 @@ int ll_debugfs_register_super(struct super_block *sb, const char *name) }/* do counter init */ -for (id =0 ; id <LPROC_LL_FILE_OPCODES ; id++) { -u32 type = llite_opcode_table[id].type; -void *ptr ="unknown" ; - -if (type &LPROCFS_TYPE_REQS ) - ptr ="reqs" ; -else if (type &LPROCFS_TYPE_BYTES ) - ptr ="bytes" ; -else if (type &LPROCFS_TYPE_USEC ) - ptr ="usec" ; +for (id =0 ; id <LPROC_LL_FILE_OPCODES ; id++)lprocfs_counter_init (sbi->ll_stats, - llite_opcode_table[id].opcode, type, - llite_opcode_table[id].opname, ptr); - } + llite_opcode_table[id].lfo_opcode, + llite_opcode_table[id].lfo_config, + llite_opcode_table[id].lfo_opname);debugfs_create_file ("stats" ,0644 , sbi->ll_debugfs_entry, sbi->ll_stats, &lprocfs_stats_seq_fops);
@@ -1919,8 +1910,8 @@ int ll_debugfs_register_super(struct super_block *sb, const char *name) }for (id =0 ; id <ARRAY_SIZE (ra_stat_string); id++) -lprocfs_counter_init (sbi->ll_ra_stats, id,0 , - ra_stat_string[id],"pages" ); +lprocfs_counter_init (sbi->ll_ra_stats, id,LPROCFS_TYPE_PAGES , + ra_stat_string[id]);debugfs_create_file ("read_ahead_stats" ,0644 , sbi->ll_debugfs_entry, sbi->ll_ra_stats, &lprocfs_stats_seq_fops);
fs/lustre/obdclass/lprocfs_status.c +50 -6
86 lines not on this page · raw message
fs/lustre/obdclass/lu_object.c +6 -11
@@ -1099,18 +1099,13 @@ int lu_site_init(struct lu_site *s, struct lu_device *top)return -ENOMEM ; } -lprocfs_counter_init (s->ls_stats,LU_SS_CREATED , -0 ,"created" ,"created" ); -lprocfs_counter_init (s->ls_stats,LU_SS_CACHE_HIT , -0 ,"cache_hit" ,"cache_hit" ); -lprocfs_counter_init (s->ls_stats,LU_SS_CACHE_MISS , -0 ,"cache_miss" ,"cache_miss" ); -lprocfs_counter_init (s->ls_stats,LU_SS_CACHE_RACE , -0 ,"cache_race" ,"cache_race" ); +lprocfs_counter_init (s->ls_stats,LU_SS_CREATED ,0 ,"created" ); +lprocfs_counter_init (s->ls_stats,LU_SS_CACHE_HIT ,0 ,"cache_hit" ); +lprocfs_counter_init (s->ls_stats,LU_SS_CACHE_MISS ,0 ,"cache_miss" ); +lprocfs_counter_init (s->ls_stats,LU_SS_CACHE_RACE ,0 ,"cache_race" );lprocfs_counter_init (s->ls_stats,LU_SS_CACHE_DEATH_RACE , -0 ,"cache_death_race" ,"cache_death_race" ); -lprocfs_counter_init (s->ls_stats,LU_SS_LRU_PURGED , -0 ,"lru_purged" ,"lru_purged" ); +0 ,"cache_death_race" ); +lprocfs_counter_init (s->ls_stats,LU_SS_LRU_PURGED ,0 ,"lru_purged" );INIT_LIST_HEAD (&s->ls_linkage); s->ls_top_dev = top;
fs/lustre/ptlrpc/lproc_ptlrpc.c +14 -18
@@ -191,9 +191,9 @@ static const char *ll_eopcode2str(u32 opcode) {struct dentry *svc_debugfs_entry;struct lprocfs_stats *svc_stats; +enum lprocfs_counter_config config =LPROCFS_CNTR_AVGMINMAX | +LPROCFS_CNTR_STDDEV ;int i; -unsigned int svc_counter_config =LPROCFS_CNTR_AVGMINMAX | -LPROCFS_CNTR_STDDEV ;LASSERT (!*debugfs_root_ret);LASSERT (!*stats_ret);
@@ -209,37 +209,33 @@ static const char *ll_eopcode2str(u32 opcode) svc_debugfs_entry = root;lprocfs_counter_init (svc_stats,PTLRPC_REQWAIT_CNTR , - svc_counter_config,"req_waittime" ,"usec" ); + config |LPROCFS_TYPE_USECS ,"req_waittime" );lprocfs_counter_init (svc_stats,PTLRPC_REQQDEPTH_CNTR , - svc_counter_config,"req_qdepth" ,"reqs" ); + config |LPROCFS_TYPE_REQS ,"req_qdepth" );lprocfs_counter_init (svc_stats,PTLRPC_REQACTIVE_CNTR , - svc_counter_config,"req_active" ,"reqs" ); + config |LPROCFS_TYPE_REQS ,"req_active" );lprocfs_counter_init (svc_stats,PTLRPC_TIMEOUT , - svc_counter_config,"req_timeout" ,"sec" ); -lprocfs_counter_init (svc_stats,PTLRPC_REQBUF_AVAIL_CNTR , - svc_counter_config,"reqbuf_avail" ,"bufs" ); + config |LPROCFS_TYPE_SECS ,"req_timeout" ); +lprocfs_counter_init_units (svc_stats,PTLRPC_REQBUF_AVAIL_CNTR , + config,"reqbuf_avail" ,"bufs" );for (i =0 ; i <EXTRA_LAST_OPC ; i++) { -char *units; +enum lprocfs_counter_config extra_type =LPROCFS_TYPE_REQS ;switch (i) {case BRW_WRITE_BYTES :case BRW_READ_BYTES : - units ="bytes" ; -break ; -default : - units ="reqs" ; + extra_type =LPROCFS_TYPE_BYTES ;break ; }lprocfs_counter_init (svc_stats,PTLRPC_LAST_CNTR + i, - svc_counter_config, -ll_eopcode2str (i), units); + config | extra_type,ll_eopcode2str (i)); }for (i =0 ; i <LUSTRE_MAX_OPCODES ; i++) {u32 opcode = ll_rpc_opcode_table[i].opcode; -lprocfs_counter_init (svc_stats, -EXTRA_MAX_OPCODES + i, svc_counter_config, -ll_opcode2str (opcode),"usec" ); +lprocfs_counter_init (svc_stats,EXTRA_MAX_OPCODES + i, + config |LPROCFS_TYPE_USECS , +ll_opcode2str (opcode)); } debugfs_create_file("stats", 0644, svc_debugfs_entry, svc_stats,
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 21/24 lnet: Memory leak on adding existing interface
In reply to James SimmonsFrom: Frank Sehr <[email protected]>
In the function lnet_dyn_add_ni an lnet_ni structure is allocated. In case of an error the function returns without freeing the memory of the structure.
Added handling of possible lnet_net structure memory leaks.
WC-bug-id: https://jira.whamcloud.com/browse/LU-16081
Lustre-commit: 26beb8664f4533a6e ("LU-16081 lnet: Memory leak on adding existing interface")
Reviewed-on: https://review.whamcloud.com/48173
--- net/lnet/lnet/api-ni.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
net/lnet/lnet/api-ni.c +13 -4
@@ -3551,25 +3551,34 @@ int lnet_dyn_add_ni(struct lnet_ioctl_config_ni *conf)return -ENOMEM ;for (i =0 ; i < conf->lic_ncpts; i++) { -if (conf->lic_cpts[i] >=LNET_CPT_NUMBER ) +if (conf->lic_cpts[i] >=LNET_CPT_NUMBER ) { +lnet_net_free (net);return -EINVAL ; + } } ni =lnet_ni_alloc_w_cpt_array (net, conf->lic_cpts, conf->lic_ncpts, conf->lic_ni_intf); -if (!ni) +if (!ni) { +lnet_net_free (net);return -ENOMEM ; + }lnet_set_tune_defaults (tun);mutex_lock (&the_lnet.ln_api_mutex); -if (the_lnet.ln_state !=LNET_STATE_RUNNING ) +if (the_lnet.ln_state !=LNET_STATE_RUNNING ) { +lnet_net_free (net); rc = -ESHUTDOWN ; -else + }else { rc =lnet_add_net_common (net, tun); + }mutex_unlock (&the_lnet.ln_api_mutex); +if (rc) +lnet_ni_free (ni); +return rc; }
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 22/24 lustre: sec: fix detection of SELinux enforcement
In reply to James SimmonsFrom: Sebastien Buisson <[email protected]>
For newer kernels, for which selinux_is_enabled() does not exist anymore, the only way to find out if SELinux is enforced when initializing the security context is to fetch the length of the security attribute name. If it is 0, we conclude SELinux is disabled.
WC-bug-id: https://jira.whamcloud.com/browse/LU-16012
Lustre-commit: 155cbc22ba4f758cf ("LU-16012 sec: fix detection of SELinux enforcement")
Reviewed-on: https://review.whamcloud.com/48049
--- fs/lustre/llite/dir.c | 3 ++- fs/lustre/llite/llite_internal.h | 3 ++- fs/lustre/llite/namei.c | 6 ++++-- fs/lustre/llite/xattr_security.c | 12 +++++++++++- 4 files changed, 19 insertions(+), 5 deletions(-)
fs/lustre/llite/dir.c +2 -1
@@ -513,7 +513,8 @@ static int ll_dir_setdirstripe(struct dentry *dparent, struct lmv_user_md *lump,* to determine the security context for the file. So our fake * dentry should be real enough for this purpose. */ - err =ll_dentry_init_security (&dentry, mode, &dentry.d_name, + err =ll_dentry_init_security (parent, + &dentry, mode, &dentry.d_name, &op_data->op_file_secctx_name, &op_data->op_file_secctx, &op_data->op_file_secctx_size);
fs/lustre/llite/llite_internal.h +2 -1
@@ -447,7 +447,8 @@ static inline void obd_connect_set_secctx(struct obd_connect_data *data)#endif } -int ll_dentry_init_security (struct dentry *dentry,int mode,struct qstr *name, +int ll_dentry_init_security (struct inode *parent,struct dentry *dentry, +int mode,struct qstr *name,const char **secctx_name,void **secctx,u32 *secctx_size); int ll_inode_init_security(struct dentry *dentry, struct inode *inode,
fs/lustre/llite/namei.c +4 -2
@@ -891,7 +891,8 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry,if (it->it_op &IT_CREAT &&test_bit (LL_SBI_FILE_SECCTX ,ll_i2sbi (parent)->ll_flags)) { - rc = ll_dentry_init_security(dentry, it->it_create_mode, + rc = ll_dentry_init_security(parent, + dentry, it->it_create_mode, &dentry->d_name, &op_data->op_file_secctx_name, &op_data->op_file_secctx,
@@ -1570,7 +1571,8 @@ static int ll_new_node(struct inode *dir, struct dentry *dchild,ll_qos_mkdir_prep (op_data, dir);if (test_bit (LL_SBI_FILE_SECCTX , sbi->ll_flags)) { - err =ll_dentry_init_security (dchild, mode, &dchild->d_name, + err =ll_dentry_init_security (dir, + dchild, mode, &dchild->d_name, &op_data->op_file_secctx_name, &op_data->op_file_secctx, &op_data->op_file_secctx_size);
fs/lustre/llite/xattr_security.c +11 -1
@@ -38,7 +38,8 @@/* * Check for LL_SBI_FILE_SECCTX before calling. */ -int ll_dentry_init_security (struct dentry *dentry,int mode,struct qstr *name, +int ll_dentry_init_security (struct inode *parent,struct dentry *dentry, +int mode,struct qstr *name,const char **secctx_name,void **secctx,u32 *secctx_size) {
@@ -58,6 +59,15 @@ int ll_dentry_init_security(struct dentry *dentry, int mode, struct qstr *name,* from SELinux. */ +/* fetch length of security xattr name */ + rc =security_inode_listsecurity (parent,NULL ,0 ); +/* xattr name length == 0 means SELinux is disabled */ +if (rc ==0 ) +return 0 ; +/* we support SELinux only */ +if (rc !=strlen (XATTR_NAME_SELINUX ) +1 ) +return -EOPNOTSUPP ; + rc =security_dentry_init_security (dentry, mode, name, secctx, secctx_size);/* Usually, security_dentry_init_security() returns -EOPNOTSUPP when
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 23/24 lustre: idl: add checks for OBD_CONNECT flags
In reply to James SimmonsFrom: Andreas Dilger <[email protected]>
Make it harder to accidentally declare OBD_CONNECT flags without properly defining their names. Otherwise, this can cause serious compatibility problems if two features are using the same flag.
Make it clear whom to contact when reserving a new feature flag.
WC-bug-id: https://jira.whamcloud.com/browse/LU-1904
Lustre-commit: d851381ea69472448 ("LU-1904 idl: add checks for OBD_CONNECT flags")
Reviewed-on: https://review.whamcloud.com/48053
--- fs/lustre/obdclass/lprocfs_status.c | 189 +++++++++++---------- include/uapi/linux/lustre/lustre_idl.h | 291 +++++++++++++++------------------ 2 files changed, 227 insertions(+), 253 deletions(-)
fs/lustre/obdclass/lprocfs_status.c +94 -95
@@ -43,101 +43,100 @@#include <linux/seq_file.h> #include <linux/ctype.h> -static const char *const obd_connect_names[] = { -/* flags names */ -"read_only" , -"lov_index" , -"connect_from_mds" , -"write_grant" , -"server_lock" , -"version" , -"request_portal" , -"acl" , -"xattr" , -"create_on_write" , -"truncate_lock" , -"initial_transno" , -"inode_bit_locks" , -"join_file(obsolete)" , -"getattr_by_fid" , -"no_oh_for_devices" , -"remote_client" , -"remote_client_by_force" , -"max_byte_per_rpc" , -"64bit_qdata" , -"mds_capability" , -"oss_capability" , -"early_lock_cancel" , -"som" , -"adaptive_timeouts" , -"lru_resize" , -"mds_mds_connection" , -"real_conn" , -"change_qunit_size" , -"alt_checksum_algorithm" , -"fid_is_enabled" , -"version_recovery" , -"pools" , -"grant_shrink" , -"skip_orphan" , -"large_ea" , -"full20" , -"layout_lock" , -"64bithash" , -"object_max_bytes" , -"imp_recov" , -"jobstats" , -"umask" , -"einprogress" , -"grant_param" , -"flock_owner" , -"lvb_type" , -"nanoseconds_times" , -"lightweight_conn" , -"short_io" , -"pingless" , -"flock_deadlock" , -"disp_stripe" , -"open_by_fid" , -"lfsck" , -"unknown" , -"unlink_close" , -"multi_mod_rpcs" , -"dir_stripe" , -"subtree" , -"lockahead" , -"bulk_mbits" , -"compact_obdo" , -"second_flags" , -/* flags2 names */ -"file_secctx" ,/* 0x01 */ -"lockaheadv2" ,/* 0x02 */ -"dir_migrate" ,/* 0x04 */ -"sum_statfs" ,/* 0x08 */ -"overstriping" ,/* 0x10 */ -"flr" ,/* 0x20 */ -"wbc" ,/* 0x40 */ -"lock_convert" ,/* 0x80 */ -"archive_id_array" ,/* 0x100 */ -"increasing_xid" ,/* 0x200 */ -"selinux_policy" ,/* 0x400 */ -"lsom" ,/* 0x800 */ -"pcc" ,/* 0x1000 */ -"crush" ,/* 0x2000 */ -"async_discard" ,/* 0x4000 */ -"client_encryption" ,/* 0x8000 */ -"fidmap" ,/* 0x10000 */ -"getattr_pfid" ,/* 0x20000 */ -"lseek" ,/* 0x40000 */ -"dom_lvb" ,/* 0x80000 */ -"reply_mbits" ,/* 0x100000 */ -"mode_convert" ,/* 0x200000 */ -"batch_rpc" ,/* 0x400000 */ -"pcc_ro" ,/* 0x800000 */ -"mne_nid_type" ,/* 0x1000000 */ -"lock_contend" ,/* 0x2000000 */ -"atomic_open_lock" ,/* 0x4000000 */ -"name_encryption" ,/* 0x8000000 */ +static const char *const obd_connect_names[] = { +"read_only" ,/* 0x01 */ +"lov_index" ,/* 0x02 */ +"connect_from_mds" ,/* 0x03 */ +"write_grant" ,/* 0x04 */ +"server_lock" ,/* 0x10 */ +"version" ,/* 0x20 */ +"request_portal" ,/* 0x40 */ +"acl" ,/* 0x80 */ +"xattr" ,/* 0x100 */ +"create_on_write" ,/* 0x200 */ +"truncate_lock" ,/* 0x400 */ +"initial_transno" ,/* 0x800 */ +"inode_bit_locks" ,/* 0x1000 */ +"barrier" ,/* 0x2000 */ +"getattr_by_fid" ,/* 0x4000 */ +"no_oh_for_devices" ,/* 0x8000 */ +"remote_client" ,/* 0x10000 */ +"remote_client_by_force" ,/* 0x20000 */ +"max_byte_per_rpc" ,/* 0x40000 */ +"64bit_qdata" ,/* 0x80000 */ +"mds_capability" ,/* 0x100000 */ +"oss_capability" ,/* 0x200000 */ +"early_lock_cancel" ,/* 0x400000 */ +"som" ,/* 0x800000 */ +"adaptive_timeouts" ,/* 0x1000000 */ +"lru_resize" ,/* 0x2000000 */ +"mds_mds_connection" ,/* 0x4000000 */ +"real_conn" ,/* 0x8000000 */ +"change_qunit_size" ,/* 0x10000000 */ +"alt_checksum_algorithm" ,/* 0x20000000 */ +"fid_is_enabled" ,/* 0x40000000 */ +"version_recovery" ,/* 0x80000000 */ +"pools" ,/* 0x100000000 */ +"grant_shrink" ,/* 0x200000000 */ +"skip_orphan" ,/* 0x400000000 */ +"large_ea" ,/* 0x800000000 */ +"full20" ,/* 0x1000000000 */ +"layout_lock" ,/* 0x2000000000 */ +"64bithash" ,/* 0x4000000000 */ +"object_max_bytes" ,/* 0x8000000000 */ +"imp_recov" ,/* 0x10000000000 */ +"jobstats" ,/* 0x20000000000 */ +"umask" ,/* 0x40000000000 */ +"einprogress" ,/* 0x80000000000 */ +"grant_param" ,/* 0x100000000000 */ +"flock_owner" ,/* 0x200000000000 */ +"lvb_type" ,/* 0x400000000000 */ +"nanoseconds_times" ,/* 0x800000000000 */ +"lightweight_conn" ,/* 0x1000000000000 */ +"short_io" ,/* 0x2000000000000 */ +"pingless" ,/* 0x4000000000000 */ +"flock_deadlock" ,/* 0x8000000000000 */ +"disp_stripe" ,/* 0x10000000000000 */ +"open_by_fid" ,/* 0x20000000000000 */ +"lfsck" ,/* 0x40000000000000 */ +"unknown" ,/* 0x80000000000000 */ +"unlink_close" ,/* 0x100000000000000 */ +"multi_mod_rpcs" ,/* 0x200000000000000 */ +"dir_stripe" ,/* 0x400000000000000 */ +"subtree" ,/* 0x800000000000000 */ +"lockahead" ,/* 0x1000000000000000 */ +"bulk_mbits" ,/* 0x2000000000000000 */ +"compact_obdo" ,/* 0x4000000000000000 */ +"second_flags" ,/* 0x8000000000000000 */ +/* ocd_connect_flags2 names */ +"file_secctx" ,/* 0x01 */ +"lockaheadv2" ,/* 0x02 */ +"dir_migrate" ,/* 0x04 */ +"sum_statfs" ,/* 0x08 */ +"overstriping" ,/* 0x10 */ +"flr" ,/* 0x20 */ +"wbc" ,/* 0x40 */ +"lock_convert" ,/* 0x80 */ +"archive_id_array" ,/* 0x100 */ +"increasing_xid" ,/* 0x200 */ +"selinux_policy" ,/* 0x400 */ +"lsom" ,/* 0x800 */ +"pcc" ,/* 0x1000 */ +"crush" ,/* 0x2000 */ +"async_discard" ,/* 0x4000 */ +"client_encryption" ,/* 0x8000 */ +"fidmap" ,/* 0x10000 */ +"getattr_pfid" ,/* 0x20000 */ +"lseek" ,/* 0x40000 */ +"dom_lvb" ,/* 0x80000 */ +"reply_mbits" ,/* 0x100000 */ +"mode_convert" ,/* 0x200000 */ +"batch_rpc" ,/* 0x400000 */ +"pcc_ro" ,/* 0x800000 */ +"mne_nid_type" ,/* 0x1000000 */ +"lock_contend" ,/* 0x2000000 */ +"atomic_open_lock" ,/* 0x4000000 */ +"name_encryption" ,/* 0x8000000 */ NULL };
include/uapi/linux/lustre/lustre_idl.h +133 -158
312 lines not on this page · raw message
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 24/24 lustre: llite: fix stat attributes_mask
In reply to James SimmonsFrom: Sebastien Buisson <[email protected]>
Fix stat attributes_mask to return STATX_ATTR_ENCRYPTED whenever it is possible. Also fix sanityn test_106c to expect at least the 0x30 flag for attributes_mask.
WC-bug-id: https://jira.whamcloud.com/browse/LU-16085
Lustre-commit: 0e48653c27eacad29 ("LU-16085 llite: fix stat attributes_mask")
Reviewed-on: https://review.whamcloud.com/48208
--- fs/lustre/llite/file.c | 3 +++ 1 file changed, 3 insertions(+)
fs/lustre/llite/file.c +3 -0
@@ -5268,6 +5268,9 @@ int ll_getattr_dentry(struct dentry *de, struct kstat *stat, u32 request_mask, } stat->attributes_mask =STATX_ATTR_IMMUTABLE |STATX_ATTR_APPEND ; +#ifdef CONFIG_FS_ENCRYPTION + stat->attributes_mask |=STATX_ATTR_ENCRYPTED ; +#endif stat->attributes |=ll_inode_to_ext_flags (inode->i_flags); stat->result_mask &= request_mask;
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org