lustre: port OpenSFS updates Dec 29, 2021
cover lustre: port OpenSFS updates Dec 29, 2021
Port the latest OpenSFS work to the Linux client as of Dec 29, 2021
Alexander Boyko (1):
lustre: mdc: add client tunable to disable LSOM update
Alexey Lyashkov (1):
lustre: ptlrpc: use a cached value
Arshad Hussain (1):
lustre: quota: fallocate send UID/GID for quota
Chris Horn (2):
lnet: Revert "lnet: Lock primary NID logic"
lnet: Race on discovery queue
James Simmons (1):
lnet: o2iblnd: convert ibp_refcount to a kref
Lai Siyao (1):
lustre: dne: dir migration in non-recursive mode
Oleg Drokin (1):
lustre: update version to 2.14.56
Qian Yingjin (1):
lustre: llite: set ra_pages of backing_dev_info with 0
Sebastien Buisson (3):
lustre: sec: filename encryption - digest support
lustre: sec: no encryption key migrate/extend/resync/split
lustre: sec: fix handling of encrypted file with long name
Serguei Smirnov (1):
lnet: socklnd: expect two control connections maximum
fs/lustre/include/cl_object.h | 2 + fs/lustre/include/lustre_net.h | 2 +- fs/lustre/include/obd.h | 4 +- fs/lustre/llite/crypto.c | 175 +++++++++++++++++++++++++++----- fs/lustre/llite/dir.c | 20 +++- fs/lustre/llite/file.c | 66 ++++++++---- fs/lustre/llite/llite_internal.h | 25 ++++- fs/lustre/llite/llite_lib.c | 127 +++++++++++++++++++++-- fs/lustre/llite/namei.c | 83 ++++++++------- fs/lustre/llite/rw26.c | 2 +- fs/lustre/llite/statahead.c | 8 +- fs/lustre/llite/vvp_io.c | 3 - fs/lustre/llite/xattr.c | 4 +- fs/lustre/lmv/lmv_obd.c | 5 + fs/lustre/lov/lov_io.c | 4 + fs/lustre/mdc/lproc_mdc.c | 29 ++++++ fs/lustre/mdc/mdc_lib.c | 2 + fs/lustre/mdc/mdc_locks.c | 8 +- fs/lustre/mdc/mdc_request.c | 13 ++- fs/lustre/osc/osc_io.c | 8 +- fs/lustre/osc/osc_request.c | 42 ++++++-- fs/lustre/ptlrpc/pack_generic.c | 8 +- fs/lustre/ptlrpc/ptlrpc_internal.h | 1 + fs/lustre/ptlrpc/ptlrpc_module.c | 1 + fs/lustre/ptlrpc/sec_null.c | 4 +- fs/lustre/ptlrpc/sec_plain.c | 2 +- fs/lustre/ptlrpc/wiretest.c | 6 ++ include/uapi/linux/lustre/lustre_idl.h | 16 ++- include/uapi/linux/lustre/lustre_user.h | 7 +- include/uapi/linux/lustre/lustre_ver.h | 4 +- net/lnet/klnds/o2iblnd/o2iblnd.c | 11 +- net/lnet/klnds/o2iblnd/o2iblnd.h | 35 ++++--- net/lnet/klnds/socklnd/socklnd.h | 2 +- net/lnet/lnet/peer.c | 114 +++++++-------------- 34 files changed, 607 insertions(+), 236 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/13 lustre: sec: filename encryption - digest support
From: Sebastien Buisson <[email protected]>
A number of operations are allowed on encrypted files without the key:
- read file metadata (stat);
- list directories;
- remove files and directories.
In order to present valid names to users, cipher text names are base64 encoded if they are short. Otherwise we compute a digested form of the cipher text, made of the FID (16 bytes) followed by the second-to-last cipher block (16 bytes), and we base64 encode this digested form for presentation to user.
These transformations are carried out in the specific overlay functions, that now need to know the fid of the file.
As the digested form does not contain the whole cipher text name, server side needs to proceed to an operation by FID for requests such as lookup and getattr. It also relies on the content of the LinkEA to verify the digested form as received from client side.
WC-bug-id: https://jira.whamcloud.com/browse/LU-13717
Lustre-commit: ed4a625d88567a249 ("LU-13717 sec: filename encryption - digest support")
Reviewed-on: https://review.whamcloud.com/43392
--- fs/lustre/llite/crypto.c | 130 +++++++++++++++++++++++++++----- fs/lustre/llite/dir.c | 2 +- fs/lustre/llite/llite_internal.h | 15 +++- fs/lustre/llite/llite_lib.c | 11 ++- fs/lustre/llite/namei.c | 19 +++-- fs/lustre/llite/statahead.c | 8 +- fs/lustre/mdc/mdc_lib.c | 2 + fs/lustre/mdc/mdc_locks.c | 4 +- fs/lustre/mdc/mdc_request.c | 9 +++ include/uapi/linux/lustre/lustre_idl.h | 14 ++-- include/uapi/linux/lustre/lustre_user.h | 3 +- 11 files changed, 180 insertions(+), 37 deletions(-)
fs/lustre/llite/crypto.c +111 -19
@@ -178,19 +178,70 @@ static bool ll_empty_dir(struct inode *inode)* ->lookup() or we're finding the dir_entry for deletion; 0 if we cannot * proceed without the key because we're going to create the dir_entry. * @fname: the filename information to be filled in +* @fid: fid retrieved from user-provided filename * * This overlay function is necessary to properly encode @fname after * encryption, as it will be sent over the wire. +* This overlay function is also necessary to handle the case of operations +* carried out without the key. Normally llcrypt makes use of digested names in +* that case. Having a digested name works for local file systems that can call +* llcrypt_match_name(), but Lustre server side is not aware of encryption. +* So for keyless @lookup operations on long names, for Lustre we choose to +* present to users the encoded struct ll_digest_filename, instead of a digested +* name. FID and name hash can then easily be extracted and put into the +* requests sent to servers. */ int ll_setup_filename (struct inode *dir,const struct qstr *iname, -int lookup,struct fscrypt_name *fname) +int lookup,struct fscrypt_name *fname, +struct lu_fid *fid) { +int digested =0 ; +struct qstr dname;int rc; - rc =fscrypt_setup_filename (dir, iname, lookup, fname); +if (fid) { + fid->f_seq =0 ; + fid->f_oid =0 ; + fid->f_ver =0 ; + } + +if (fid &&IS_ENCRYPTED (dir) && !fscrypt_has_encryption_key (dir) && + iname->name[0 ] =='_' ) + digested =1 ; + + dname.name = iname->name + digested; + dname.len = iname->len - digested; + +if (fid) { + fid->f_seq =0 ; + fid->f_oid =0 ; + fid->f_ver =0 ; + } + rc =fscrypt_setup_filename (dir, &dname, lookup, fname);if (rc)return rc; +if (digested) { +/* Without the key, for long names user should have struct +* ll_digest_filename representation of the dentry instead of +* the name. So make sure it is valid, return fid and put +* excerpt of cipher text name in disk_name. +*/ +struct ll_digest_filename *digest; + +if (fname->crypto_buf.len <sizeof (struct ll_digest_filename )) { + rc = -EINVAL ; + goto out_free; + } + digest = (struct ll_digest_filename *)fname->crypto_buf.name; + *fid = digest->ldf_fid; +if (!fid_is_sane (fid)) { + rc = -EINVAL ; + goto out_free; + } + fname->disk_name.name = digest->ldf_excerpt; + fname->disk_name.len =LLCRYPT_FNAME_DIGEST_SIZE ; + }if (IS_ENCRYPTED (dir) && !name_is_dot_or_dotdot (fname->disk_name.name, fname->disk_name.len)) {
@@ -224,6 +275,11 @@ int ll_setup_filename(struct inode *dir, const struct qstr *iname,return rc; } +#define LLCRYPT_FNAME_DIGEST (name, len) \ + ((name) + round_down((len) - FS_CRYPTO_BLOCK_SIZE - 1, \ + FS_CRYPTO_BLOCK_SIZE)) +#define LLCRYPT_FNAME_MAX_UNDIGESTED_SIZE 32 +/** * ll_fname_disk_to_usr() - overlay to fscrypt_fname_disk_to_usr * @inode: the inode to convert name
@@ -231,40 +287,76 @@ int ll_setup_filename(struct inode *dir, const struct qstr *iname,* @minor_hash: minor hash for inode * @iname: the user-provided filename needing conversion * @oname: the filename information to be filled in +* @fid: the user-provided fid for filename * * The caller must have allocated sufficient memory for the @oname string. * * This overlay function is necessary to properly decode @iname before * decryption, as it comes from the wire. +* This overlay function is also necessary to handle the case of operations +* carried out without the key. Normally llcrypt makes use of digested names in +* that case. Having a digested name works for local file systems that can call +* llcrypt_match_name(), but Lustre server side is not aware of encryption. +* So for keyless @lookup operations on long names, for Lustre we choose to +* present to users the encoded struct ll_digest_filename, instead of a digested +* name. FID and name hash can then easily be extracted and put into the +* requests sent to servers. */ int ll_fname_disk_to_usr (struct inode *inode,u32 hash,u32 minor_hash, -struct fscrypt_str *iname,struct fscrypt_str *oname) +struct fscrypt_str *iname,struct fscrypt_str *oname, +struct lu_fid *fid) {struct fscrypt_str lltr =FSTR_INIT (iname->name, iname->len); +struct ll_digest_filename digest; +int digested =0 ;char *buf =NULL ;int rc; -if (IS_ENCRYPTED (inode) && - !name_is_dot_or_dotdot (lltr.name, lltr.len) && -strnchr (lltr.name, lltr.len,'=' )) { -/* Only proceed to critical decode if -* iname contains espace char '='. -*/ -int len = lltr.len; - - buf =kmalloc (len,GFP_NOFS ); -if (!buf) -return -ENOMEM ; - - len =critical_decode (lltr.name, len, buf); - lltr.name = buf; - lltr.len = len; +if (IS_ENCRYPTED (inode)) { +if (!name_is_dot_or_dotdot (lltr.name, lltr.len) && +strnchr (lltr.name, lltr.len,'=' )) { +/* Only proceed to critical decode if +* iname contains espace char '='. +*/ +int len = lltr.len; + + buf =kmalloc (len,GFP_NOFS ); +if (!buf) +return -ENOMEM ; + + len =critical_decode (lltr.name, len, buf); + lltr.name = buf; + lltr.len = len; + } +if (lltr.len >LLCRYPT_FNAME_MAX_UNDIGESTED_SIZE && + !fscrypt_has_encryption_key (inode)) { + digested =1 ; +/* Without the key for long names, set the dentry name +* to the representing struct ll_digest_filename. It +* will be encoded by llcrypt for display, and will +* enable further lookup requests. +*/ +if (!fid) +return -EINVAL ; + digest.ldf_fid = *fid; +memcpy (digest.ldf_excerpt, +LLCRYPT_FNAME_DIGEST (lltr.name, lltr.len), +LLCRYPT_FNAME_DIGEST_SIZE ); + + lltr.name = (char *)&digest; + lltr.len =sizeof (digest); + + oname->name[0 ] ='_' ; + oname->name = oname->name +1 ; + oname->len--; + } } - rc =fscrypt_fname_disk_to_usr (inode, hash, minor_hash, &lltr, oname);kfree (buf); + oname->name = oname->name - digested; + oname->len = oname->len + digested;return rc; }
fs/lustre/llite/dir.c +1 -1
@@ -250,7 +250,7 @@ int ll_dir_read(struct inode *inode, u64 *ppos, struct md_op_data *op_data, = FSTR_INIT(ent->lde_name, namelen); rc =ll_fname_disk_to_usr (inode,0 ,0 , &de_name, - &lltr); + &lltr, &fid); de_name = lltr; lltr.len = save_len;if (rc) {
fs/lustre/llite/llite_internal.h +13 -2
@@ -1705,11 +1705,22 @@ 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, llcrypt does not compute a digested form of this digest. +*/ +struct ll_digest_filename { +struct lu_fid ldf_fid; +char ldf_excerpt[LLCRYPT_FNAME_DIGEST_SIZE ]; +}; +int ll_setup_filename (struct inode *dir,const struct qstr *iname, -int lookup,struct fscrypt_name *fname); +int lookup,struct fscrypt_name *fname, +struct lu_fid *fid);int ll_fname_disk_to_usr (struct inode *inode,u32 hash,u32 minor_hash, -struct fscrypt_str *iname,struct fscrypt_str *oname); +struct fscrypt_str *iname,struct fscrypt_str *oname, +struct lu_fid *fid);int ll_revalidate_d_crypto (struct dentry *dentry,unsigned int flags);#else int ll_setup_filename(struct inode *dir, const struct qstr *iname,
fs/lustre/llite/llite_lib.c +10 -1
@@ -3067,6 +3067,8 @@ struct md_op_data *ll_prep_md_op_data(struct md_op_data *op_data, }else if (name && namelen) {struct qstr dname =QSTR_INIT (name, namelen);struct inode *dir; +struct lu_fid *pfid =NULL ; +struct lu_fid fid;int lookup;if (!S_ISDIR (i1->i_mode) && i2 &&S_ISDIR (i2->i_mode)) {
@@ -3077,11 +3079,18 @@ struct md_op_data *ll_prep_md_op_data(struct md_op_data *op_data, dir = i1; lookup = (int )(opc ==LUSTRE_OPC_ANY ); } - rc =ll_setup_filename (dir, &dname, lookup, &fname); +if (opc ==LUSTRE_OPC_ANY && lookup) + pfid = &fid; + rc =ll_setup_filename (dir, &dname, lookup, &fname, pfid);if (rc) {ll_finish_md_op_data (op_data);return ERR_PTR (rc); } +if (pfid && !fid_is_zero (pfid)) { +if (i2 ==NULL ) + op_data->op_fid2 = fid; + op_data->op_bias =MDS_FID_OP ; + }if (fname.disk_name.name && fname.disk_name.name != (unsigned char *)name)/* op_data->op_name must be freed after use */
fs/lustre/llite/namei.c +14 -5
@@ -814,6 +814,7 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry,char secctx_name[XATTR_NAME_MAX +1 ];struct fscrypt_name fname;struct inode *inode; +struct lu_fid fid;u32 opc;int rc;
@@ -856,7 +857,7 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry,* not exported function) and call it from ll_revalidate_dentry(), to * ensure we do not cache stale dentries after a key has been added. */ - rc =ll_setup_filename (parent, &dentry->d_name,1 , &fname); + rc =ll_setup_filename (parent, &dentry->d_name,1 , &fname, &fid);if ((!rc || rc == -ENOENT ) && fname.is_ciphertext_name) {spin_lock (&dentry->d_lock); dentry->d_flags |=DCACHE_ENCRYPTED_NAME ;
@@ -874,6 +875,12 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry,return ERR_CAST (op_data); goto out; } +if (!fid_is_zero (&fid)) { + op_data->op_fid2 = fid; + op_data->op_bias =MDS_FID_OP ; +if (it->it_op &IT_OPEN ) + it->it_flags |=MDS_OPEN_BY_FID ; + }/* enforce umask if acl disabled or MDS doesn't support umask */ if (!IS_POSIXACL (parent) || !exp_connect_umask (ll_i2mdexp (parent)))
@@ -1856,7 +1863,8 @@ static int ll_unlink(struct inode *dir, struct dentry *dchild)ll_i2info (dchild->d_inode)->lli_clob && dirty_cnt(dchild->d_inode)) op_data->op_cli_flags |= CLI_DIRTY_DATA; - op_data->op_fid2 = op_data->op_fid3; +if (fid_is_zero (&op_data->op_fid2)) + op_data->op_fid2 = op_data->op_fid3; rc =md_unlink (ll_i2sbi (dir)->ll_md_exp, op_data, &request);ll_finish_md_op_data (op_data);if (rc)
@@ -1926,7 +1934,8 @@ static int ll_rmdir(struct inode *dir, struct dentry *dchild)if (dchild->d_inode) op_data->op_fid3 = *ll_inode2fid (dchild->d_inode); - op_data->op_fid2 = op_data->op_fid3; +if (fid_is_zero (&op_data->op_fid2)) + op_data->op_fid2 = op_data->op_fid3; rc =md_unlink (ll_i2sbi (dir)->ll_md_exp, op_data, &request);ll_finish_md_op_data (op_data);if (rc ==0 ) {
@@ -2068,10 +2077,10 @@ static int ll_rename(struct inode *src, struct dentry *src_dchild,if (tgt_dchild->d_inode) op_data->op_fid4 = *ll_inode2fid (tgt_dchild->d_inode); - err =ll_setup_filename (src, &src_dchild->d_name,1 , &foldname); + err =ll_setup_filename (src, &src_dchild->d_name,1 , &foldname,NULL );if (err)return err; - err =ll_setup_filename (tgt, &tgt_dchild->d_name,1 , &fnewname); + err =ll_setup_filename (tgt, &tgt_dchild->d_name,1 , &fnewname,NULL );if (err) {fscrypt_free_filename (&foldname);return err;
fs/lustre/llite/statahead.c +6 -2
@@ -1141,14 +1141,16 @@ static int ll_statahead_thread(void *arg)if (IS_ENCRYPTED (dir)) {struct fscrypt_str de_name =FSTR_INIT (ent->lde_name, namelen); +struct lu_fid fid; rc =fscrypt_fname_alloc_buffer (dir,NAME_MAX , &lltr);if (rc <0 )continue ; +fid_le_to_cpu (&fid, &ent->lde_fid);if (ll_fname_disk_to_usr (dir,0 ,0 , &de_name, - &lltr)) { + &lltr, &fid)) {fscrypt_fname_free_buffer (&lltr);continue ; }
@@ -1391,9 +1393,11 @@ static int is_first_dirent(struct inode *dir, struct dentry *dentry)if (IS_ENCRYPTED (dir)) {struct fscrypt_str de_name =FSTR_INIT (ent->lde_name, namelen); +struct lu_fid fid; +fid_le_to_cpu (&fid, &ent->lde_fid);if (ll_fname_disk_to_usr (dir,0 ,0 , &de_name, - &lltr)) + &lltr, &fid))continue ; name = lltr.name; namelen = lltr.len;
fs/lustre/mdc/mdc_lib.c +2 -0
@@ -621,6 +621,8 @@ void mdc_getattr_pack(struct req_capsule *pill, u64 valid, u32 flags, b->mbo_valid = valid;if (op_data->op_bias &MDS_CROSS_REF ) b->mbo_valid |=OBD_MD_FLCROSSREF ; +if (op_data->op_bias &MDS_FID_OP ) + b->mbo_valid |=OBD_MD_NAMEHASH ; b->mbo_eadatasize = ea_size; b->mbo_flags = flags;__mdc_pack_body (b, op_data->op_suppgids[0 ]);
fs/lustre/mdc/mdc_locks.c +3 -1
@@ -1320,8 +1320,10 @@ int mdc_intent_lock(struct obd_export *exp, struct md_op_data *op_data, it->it_flags); lockh.cookie =0 ; +/* MDS_FID_OP is not a revalidate case */ if (fid_is_sane (&op_data->op_fid2) && - (it->it_op & (IT_LOOKUP |IT_GETATTR |IT_READDIR ))) { + (it->it_op & (IT_LOOKUP |IT_GETATTR |IT_READDIR )) && + !(op_data->op_bias &MDS_FID_OP )) {/* We could just return 1 immediately, but since we should only * be called in revalidate_it if we already have a lock, let's * verify that.
fs/lustre/mdc/mdc_request.c +9 -0
@@ -287,6 +287,15 @@ static int mdc_getattr_name(struct obd_export *exp, struct md_op_data *op_data, op_data->op_mode);req_capsule_set_size (&req->rq_pill, &RMF_ACL ,RCL_SERVER , acl_bufsize);ptlrpc_request_set_replen (req); +if (op_data->op_bias &MDS_FID_OP ) { +struct mdt_body *b =req_capsule_client_get (&req->rq_pill, + &RMF_MDT_BODY ); + +if (b) { + b->mbo_valid |=OBD_MD_NAMEHASH ; + b->mbo_fid2 = op_data->op_fid2; + } + } rc =mdc_getattr_common (exp, req);if (rc) {
include/uapi/linux/lustre/lustre_idl.h +9 -5
@@ -1197,11 +1197,14 @@ static inline __u32 lov_mds_md_size(__u16 stripes, __u32 lmm_magic)#define OBD_MD_DEFAULT_MEA (0x0040000000000000ULL)/* default MEA */ #define OBD_MD_FLOSTLAYOUT (0x0080000000000000ULL)/* contain ost_layout */ #define OBD_MD_FLPROJID (0x0100000000000000ULL)/* project ID */ -#define OBD_MD_SECCTX (0x0200000000000000ULL)/* embed security xattr */ -#define OBD_MD_FLLAZYSIZE (0x0400000000000000ULL)/* Lazy size */ -#define OBD_MD_FLLAZYBLOCKS (0x0800000000000000ULL)/* Lazy blocks */ +#define OBD_MD_SECCTX (0x0200000000000000ULL)/* embed security xattr */ +#define OBD_MD_FLLAZYSIZE (0x0400000000000000ULL)/* Lazy size */ +#define OBD_MD_FLLAZYBLOCKS (0x0800000000000000ULL)/* Lazy blocks */ #define OBD_MD_FLBTIME (0x1000000000000000ULL)/* birth time */ -#define OBD_MD_ENCCTX (0x2000000000000000ULL)/* embed encryption ctx */ +#define OBD_MD_ENCCTX (0x2000000000000000ULL)/* embed encryption ctx */ +#define OBD_MD_NAMEHASH (0x4000000000000000ULL)/* use hash instead of name +* in case of encryption +*/ #define OBD_MD_FLALLQUOTA (OBD_MD_FLUSRQUOTA | \ OBD_MD_FLGRPQUOTA | \
@@ -1705,7 +1708,8 @@ enum mds_op_bias {MDS_PCC_ATTACH =1 <<19 ,MDS_CLOSE_UPDATE_TIMES =1 <<20 ,/* setstripe create only, don't restripe if target exists */ - MDS_SETSTRIPE_CREATE = 1 << 21, +MDS_SETSTRIPE_CREATE =1 <<21 , + MDS_FID_OP = 1 << 22, };#define MDS_CLOSE_INTENT (MDS_HSM_RELEASE | MDS_CLOSE_LAYOUT_SWAP | \
include/uapi/linux/lustre/lustre_user.h +2 -1
@@ -1221,12 +1221,13 @@ enum la_valid {#define MDS_OPEN_PCC 010000000000000ULL/* PCC: auto RW-PCC cache attach * for newly created file */ +#define MDS_OP_WITH_FID 020000000000000ULL/* operation carried out by FID */ #define MDS_OPEN_FL_INTERNAL (MDS_OPEN_HAS_EA | MDS_OPEN_HAS_OBJS | \ MDS_OPEN_OWNEROVERRIDE | MDS_OPEN_LOCK | \ MDS_OPEN_BY_FID | MDS_OPEN_LEASE | \ MDS_OPEN_RELEASE | MDS_OPEN_RESYNC | \ - MDS_OPEN_PCC) + MDS_OPEN_PCC | MDS_OP_WITH_FID)/********* Changelogs **********/ /** Changelog record types */
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/13 lnet: Revert "lnet: Lock primary NID logic"
In reply to James SimmonsFrom: Chris Horn <[email protected]>
This patch breaks client mounts under certain LNet configurations.
This reverts commit f2f168e3daf12850f40f991d74e04eb283c2376f
WC-bug-id: https://jira.whamcloud.com/browse/LU-15169
Lustre-commit: f2f168e3daf12850f ("LU-15169 Revert "LU-14668 lnet: Lock primary NID logic")
Reviewed-on: https://review.whamcloud.com/45386
--- net/lnet/lnet/peer.c | 67 +++++++++++++--------------------------------------- 1 file changed, 16 insertions(+), 51 deletions(-)
net/lnet/lnet/peer.c +16 -51
@@ -535,15 +535,6 @@ static void lnet_peer_cancel_discovery(struct lnet_peer *lp) } } -/* If we're asked to lock down the primary NID we shouldn't be -* deleting it -*/ -if (lp->lp_state &LNET_PEER_LOCK_PRIMARY && -nid_same (&primary_nid, &nid)) { - rc = -EPERM ; - goto out; - } - lpni =lnet_peer_ni_find_locked (&nid);if (!lpni) { rc = -ENOENT ;
@@ -1448,18 +1439,13 @@ struct lnet_peer_ni ** down then this discovery can introduce long delays into the mount * process, so skip it if it isn't necessary. */ -if (!lnet_peer_discovery_disabled && !lnet_peer_is_uptodate (lp)) { +while (!lnet_peer_discovery_disabled && !lnet_peer_is_uptodate (lp)) {spin_lock (&lp->lp_lock);/* force a full discovery cycle */ - lp->lp_state |=LNET_PEER_FORCE_PING |LNET_PEER_FORCE_PUSH | -LNET_PEER_LOCK_PRIMARY ; + lp->lp_state |=LNET_PEER_FORCE_PING |LNET_PEER_FORCE_PUSH ;spin_unlock (&lp->lp_lock); -/* start discovery in the background. Messages to that -* peer will not go through until the discovery is -* complete -*/ - rc =lnet_discover_peer_locked (lpni, cpt, false); + rc =lnet_discover_peer_locked (lpni, cpt, true);if (rc) goto out_decref;/* The lpni (or lp) for this NID may have changed and our ref is
@@ -1473,6 +1459,14 @@ struct lnet_peer_ni * goto out_unlock; } lp = lpni->lpni_peer_net->lpn_peer; + +/* If we find that the peer has discovery disabled then we will +* not modify whatever primary NID is currently set for this +* peer. Thus, we can break out of this loop even if the peer +* is not fully up to date. +*/ +if (lnet_is_discovery_disabled (lp)) +break ; } primary_nid =lnet_nid_to_nid4 (&lp->lp_primary_nid); out_decref:
@@ -1579,8 +1573,6 @@ struct lnet_peer_net *lnet_peer_clr_non_mr_pref_nids (lp); } } -if (flags &LNET_PEER_LOCK_PRIMARY ) - lp->lp_state |=LNET_PEER_LOCK_PRIMARY ;spin_unlock (&lp->lp_lock); lp->lp_nnis++;
@@ -1742,27 +1734,9 @@ struct lnet_peer_net * }/* If this is the primary NID, destroy the peer. */ if (lnet_peer_ni_is_primary (lpni)) { -struct lnet_peer *lp2 = +struct lnet_peer *rtr_lp = lpni->lpni_peer_net->lpn_peer; -int rtr_refcount = lp2->lp_rtr_refcount; - -/* If the new peer that this NID belongs to is -* a primary NID for another peer which we're -* suppose to preserve the Primary for then we -* don't want to mess with it. But the -* configuration is wrong at this point, so we -* should flag both of these peers as in a bad -* state -*/ -if (lp2->lp_state &LNET_PEER_LOCK_PRIMARY ) { -spin_lock (&lp->lp_lock); - lp->lp_state |=LNET_PEER_BAD_CONFIG ; -spin_unlock (&lp->lp_lock); -spin_lock (&lp2->lp_lock); - lp2->lp_state |=LNET_PEER_BAD_CONFIG ; -spin_unlock (&lp2->lp_lock); - goto out_free_lpni; - } +int rtr_refcount = rtr_lp->lp_rtr_refcount;/* if we're trying to delete a router it means * we're moving this peer NI to a new peer so must
@@ -1770,9 +1744,9 @@ struct lnet_peer_net **/ if (rtr_refcount >0 ) { flags |=LNET_PEER_RTR_NI_FORCE_DEL ; -lnet_rtr_transfer_to_peer (lp2, lp); +lnet_rtr_transfer_to_peer (rtr_lp, lp); } -lnet_peer_del (lp2); +lnet_peer_del (lpni->lpni_peer_net->lpn_peer);lnet_peer_ni_decref_locked (lpni); lpni =lnet_peer_ni_alloc (&nid);if (!lpni) {
@@ -1830,8 +1804,7 @@ struct lnet_peer_net *if (lnet_nid_to_nid4 (&lp->lp_primary_nid) == nid) goto out; -if (!(lp->lp_state &LNET_PEER_LOCK_PRIMARY )) -lnet_nid4_to_nid (nid, &lp->lp_primary_nid); +lnet_nid4_to_nid (nid, &lp->lp_primary_nid); rc =lnet_peer_add_nid (lp, nid, flags);if (rc) {
@@ -1839,14 +1812,6 @@ struct lnet_peer_net * goto out; } out: -/* if this is a configured peer or the primary for that peer has -* been locked, then we don't want to flag this scenario as -* a failure -*/ -if (lp->lp_state &LNET_PEER_CONFIGURED || - lp->lp_state &LNET_PEER_LOCK_PRIMARY ) -return 0 ; -CDEBUG (D_NET ,"peer %s NID %s: %d\n" ,libcfs_nidstr (&old),libcfs_nid2str (nid), 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 3/13 lustre: quota: fallocate send UID/GID for quota
In reply to James SimmonsFrom: Arshad Hussain <[email protected]>
Calling fallocate() on a newly created file did not account quota usage properly because the OST object did not have a UID/GID assigned yet. Update the fallocate code in the OSC to always send the file UID/GID/PROJID to the OST so that the object ownership can be updated before space is allocated.
WC-bug-id: https://jira.whamcloud.com/browse/LU-15167
Lustre-commit: 789038c97ae107287 ("LU-15167 quota: fallocate send UID/GID for quota")
Reviewed-on: https://review.whamcloud.com/45475
--- fs/lustre/include/cl_object.h | 2 ++ fs/lustre/llite/file.c | 8 ++++++++ fs/lustre/lov/lov_io.c | 4 ++++ fs/lustre/osc/osc_io.c | 8 +++++++- 4 files changed, 21 insertions(+), 1 deletion(-)
fs/lustre/include/cl_object.h +2 -0
@@ -1877,6 +1877,8 @@ struct cl_io {int sa_falloc_mode;loff_t sa_falloc_offset;loff_t sa_falloc_end; +uid_t sa_falloc_uid; +gid_t sa_falloc_gid; } ci_setattr;struct cl_data_version_io {u64 dv_data_version;
fs/lustre/llite/file.c +8 -0
@@ -5244,6 +5244,14 @@ int cl_falloc(struct file *file, struct inode *inode, int mode, loff_t offset, io->u.ci_setattr.sa_falloc_offset = offset; io->u.ci_setattr.sa_falloc_end = offset + len; io->u.ci_setattr.sa_subtype =CL_SETATTR_FALLOCATE ; + +CDEBUG (D_INODE ,"UID %u GID %u\n" , +from_kuid (&init_user_ns, inode->i_uid), +from_kgid (&init_user_ns, inode->i_gid)); + + io->u.ci_setattr.sa_falloc_uid =from_kuid (&init_user_ns, inode->i_uid); + io->u.ci_setattr.sa_falloc_gid =from_kgid (&init_user_ns, inode->i_gid); +if (io->u.ci_setattr.sa_falloc_end > size) {loff_t newsize = io->u.ci_setattr.sa_falloc_end;
fs/lustre/lov/lov_io.c +4 -0
@@ -680,6 +680,10 @@ static void lov_io_sub_inherit(struct lov_io_sub *sub, struct lov_io *lio,if (cl_io_is_fallocate (io)) { io->u.ci_setattr.sa_falloc_offset = start; io->u.ci_setattr.sa_falloc_end = end; + io->u.ci_setattr.sa_falloc_uid = + parent->u.ci_setattr.sa_falloc_uid; + io->u.ci_setattr.sa_falloc_gid = + parent->u.ci_setattr.sa_falloc_gid; }if (cl_io_is_trunc (io)) {loff_t new_size = parent->u.ci_setattr.sa_attr.lvb_size;
fs/lustre/osc/osc_io.c +7 -1
@@ -669,7 +669,13 @@ static int osc_io_setattr_start(const struct lu_env *env, oa->o_size = io->u.ci_setattr.sa_falloc_offset; oa->o_blocks = io->u.ci_setattr.sa_falloc_end; - oa->o_valid |=OBD_MD_FLSIZE |OBD_MD_FLBLOCKS ; + oa->o_uid = io->u.ci_setattr.sa_falloc_uid; + oa->o_gid = io->u.ci_setattr.sa_falloc_gid; + oa->o_valid |=OBD_MD_FLSIZE |OBD_MD_FLBLOCKS | +OBD_MD_FLUID |OBD_MD_FLGID ; + +CDEBUG (D_INODE ,"size %llu blocks %llu uid %u gid %u\n" , + oa->o_size, oa->o_blocks, oa->o_uid, oa->o_gid); result =osc_fallocate_base (osc_export (cl2osc (obj)), oa, osc_async_upcall, cbargs, falloc_mode);
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/13 lustre: mdc: add client tunable to disable LSOM update
In reply to James SimmonsFrom: Alexander Boyko <[email protected]>
It seems that mdt_lsom_update() has a serious issue with a single shared file because of its mdt-level mutex for every close request. The patch adds mdc_lsom parameter to mdc, base on it state client sends or not LSOM updates to MDT. By default LSOM is on.
lctl set_param mdc.*.mdc_lsom=[on|off]
For a configuration when LSOM is not used the patch helps MDT with load avarage with a specific load when many threads open/read/close for a single file.
HPE-bug-id: LUS-10604
WC-bug-id: https://jira.whamcloud.com/browse/LU-15252
Lustre-commit: 19172ed37851fdd57 ("LU-15252 mdc: add client tunable to disable LSOM update")
Reviewed-on: https://review.whamcloud.com/45619
--- fs/lustre/include/obd.h | 3 ++- fs/lustre/mdc/lproc_mdc.c | 29 +++++++++++++++++++++++++++++ fs/lustre/mdc/mdc_request.c | 4 +++- 3 files changed, 34 insertions(+), 2 deletions(-)
fs/lustre/include/obd.h +2 -1
@@ -208,7 +208,8 @@ struct client_obd {/* checksumming for data sent over the network */ unsigned int cl_checksum:1, /* 0 = disabled, 1 = enabled */ cl_checksum_dump:1, /* same */ - cl_ocd_grant_param:1; + cl_ocd_grant_param:1, + cl_lsom_update:1; /* send LSOM updates *//* supported checksum types that are worked out at connect time */ enum lustre_sec_part cl_sp_me;enum lustre_sec_part cl_sp_to;
fs/lustre/mdc/lproc_mdc.c +29 -0
@@ -566,6 +566,33 @@ static ssize_t mdc_dom_min_repsize_seq_write(struct file *file, }LDEBUGFS_SEQ_FOPS (mdc_dom_min_repsize); +static int mdc_lsom_seq_show (struct seq_file *m,void *v) +{ +struct obd_device *dev = m->private; + +seq_printf (m,"%s\n" , dev->u.cli.cl_lsom_update ?"On" :"Off" ); + +return 0 ; +} + +static ssize_t mdc_lsom_seq_write (struct file *file, +const char __user *buffer, +size_t count,loff_t *off) +{ +struct obd_device *dev; +bool val; +int rc; + + dev = ((struct seq_file *)file->private_data)->private; + rc =kstrtobool_from_user (buffer, count, &val); +if (rc) +return rc; + + dev->u.cli.cl_lsom_update = val; +return count; +} +LDEBUGFS_SEQ_FOPS (mdc_lsom); +LDEBUGFS_SEQ_FOPS_RO_TYPE (mdc, connect_flags);LDEBUGFS_SEQ_FOPS_RO_TYPE (mdc, server_uuid);LDEBUGFS_SEQ_FOPS_RO_TYPE (mdc, timeouts);
@@ -601,6 +628,8 @@ static ssize_t mdc_dom_min_repsize_seq_write(struct file *file, .fops = &mdc_stats_fops }, { .name = "mdc_dom_min_repsize", .fops = &mdc_dom_min_repsize_fops }, + { .name = "mdc_lsom", + .fops = &mdc_lsom_fops }, { NULL } };
fs/lustre/mdc/mdc_request.c +3 -1
@@ -952,7 +952,8 @@ static int mdc_close(struct obd_export *exp, struct md_op_data *op_data, req->rq_request_portal =MDS_READPAGE_PORTAL ;ptlrpc_at_set_req_timeout (req); -if (!(exp_connect_flags2 (exp) &OBD_CONNECT2_LSOM )) +if (!obd->u.cli.cl_lsom_update || + !(exp_connect_flags2 (exp) &OBD_CONNECT2_LSOM )) op_data->op_xvalid &= ~(OP_XVALID_LAZYSIZE |OP_XVALID_LAZYBLOCKS );
@@ -2842,6 +2843,7 @@ int mdc_setup(struct obd_device *obd, struct lustre_cfg *cfg) goto err_osc_cleanup; obd->u.cli.cl_dom_min_inline_repsize =MDC_DOM_DEF_INLINE_REPSIZE ; + obd->u.cli.cl_lsom_update = true;ns_register_cancel (obd->obd_namespace, mdc_cancel_weight);
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/13 lustre: dne: dir migration in non-recursive mode
In reply to James SimmonsFrom: Lai Siyao <[email protected]>
Add an option "-d|--directory" option for LL_IOC_MIGRATE to migrate specified directory only, which is similar to "ls -d".
WC-bug-id: https://jira.whamcloud.com/browse/LU-14975
Lustre-commit: 5604a6d270b8be13a ("LU-14975 dne: dir migration in non-recursive mode")
Reviewed-on: https://review.whamcloud.com/44802
--- fs/lustre/llite/dir.c | 5 ++++- fs/lustre/llite/file.c | 7 ++++++- fs/lustre/llite/llite_internal.h | 2 +- fs/lustre/lmv/lmv_obd.c | 5 +++++ fs/lustre/ptlrpc/wiretest.c | 6 ++++++ include/uapi/linux/lustre/lustre_idl.h | 2 ++ 6 files changed, 24 insertions(+), 3 deletions(-)
fs/lustre/llite/dir.c +4 -1
@@ -2102,6 +2102,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)struct lmv_user_md *lum;char *filename;int namelen =0 ; +u32 flags;int len;int rc;
@@ -2117,6 +2118,8 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg) filename = data->ioc_inlbuf1; namelen = data->ioc_inllen1; + flags = data->ioc_type; +if (namelen <1 || namelen !=strlen (filename) +1 ) {CDEBUG (D_INFO ,"IOC_MDC_LOOKUP missing filename\n" ); rc = -EINVAL ;
@@ -2132,7 +2135,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg) goto migrate_free; } - rc =ll_migrate (inode, file, lum, filename); + rc =ll_migrate (inode, file, lum, filename, flags); migrate_free:kvfree (data);
fs/lustre/llite/file.c +6 -1
@@ -4682,7 +4682,7 @@ int ll_get_fid_by_name(struct inode *parent, const char *name, }int ll_migrate (struct inode *parent,struct file *file,struct lmv_user_md *lum, -const char *name) +const char *name,u32 flags) {struct ptlrpc_request *request =NULL ;struct obd_client_handle *och =NULL ;
@@ -4779,6 +4779,11 @@ int ll_migrate(struct inode *parent, struct file *file, struct lmv_user_md *lum, op_data->op_data = lum; op_data->op_data_size = lumlen; +/* migrate dirent only for subdirs if MDS_MIGRATE_NSONLY set */ +if (S_ISDIR (child_inode->i_mode) && (flags &MDS_MIGRATE_NSONLY ) && +lmv_dir_layout_changing (ll_i2info (parent)->lli_lsm_md)) + op_data->op_bias |=MDS_MIGRATE_NSONLY ; + again:if (S_ISREG (child_inode->i_mode)) { och =ll_lease_open (child_inode,NULL ,FMODE_WRITE ,0 );
fs/lustre/llite/llite_internal.h +1 -1
@@ -1130,7 +1130,7 @@ static inline int ll_inode_flags_to_xflags(int inode_flags) }int ll_migrate (struct inode *parent,struct file *file, -struct lmv_user_md *lum,const char *name); +struct lmv_user_md *lum,const char *name,u32 flags);int ll_get_fid_by_name (struct inode *parent,const char *name,int namelen,struct lu_fid *fid,struct inode **inode);int ll_inode_permission (struct inode *inode,int mask);
fs/lustre/lmv/lmv_obd.c +5 -0
@@ -2227,6 +2227,11 @@ static int lmv_migrate(struct obd_export *exp, struct md_op_data *op_data, tp_tgt =lmv_tgt (lmv, oinfo->lmo_mds);if (!tp_tgt)return -ENODEV ; + +/* parent unchanged and update namespace only */ +if (lu_fid_eq (&op_data->op_fid4, &op_data->op_fid2) && + op_data->op_bias &MDS_MIGRATE_NSONLY ) +return -EALREADY ; } }else { sp_tgt = parent_tgt;
fs/lustre/ptlrpc/wiretest.c +6 -0
@@ -2119,6 +2119,12 @@ void lustre_assert_wire_constants(void) (unsigned int)MDS_PCC_ATTACH);LASSERTF (MDS_CLOSE_UPDATE_TIMES ==0x00100000UL ,"found 0x%.8xUL\n" , (unsigned int )MDS_CLOSE_UPDATE_TIMES ); +LASSERTF (MDS_SETSTRIPE_CREATE ==0x00200000UL ,"found 0x%.8xUL\n" , + (unsigned int )MDS_SETSTRIPE_CREATE ); +LASSERTF (MDS_FID_OP ==0x00400000UL ,"found 0x%.8xUL\n" , + (unsigned int )MDS_FID_OP ); +LASSERTF (MDS_MIGRATE_NSONLY ==0x00800000UL ,"found 0x%.8xUL\n" , + (unsigned int )MDS_MIGRATE_NSONLY );/* Checks for struct mdt_body */ LASSERTF((int)sizeof(struct mdt_body) == 216, "found %lld\n",
include/uapi/linux/lustre/lustre_idl.h +2 -0
@@ -1710,6 +1710,8 @@ enum mds_op_bias {/* setstripe create only, don't restripe if target exists */ MDS_SETSTRIPE_CREATE =1 <<21 ,MDS_FID_OP =1 <<22 , +/* migrate dirent only */ + MDS_MIGRATE_NSONLY = 1 << 23, };#define MDS_CLOSE_INTENT (MDS_HSM_RELEASE | MDS_CLOSE_LAYOUT_SWAP | \
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/13 lustre: update version to 2.14.56
In reply to James SimmonsFrom: Oleg Drokin <[email protected]>
New tag 2.14.56
--- 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 14 -#define LUSTRE_PATCH 55 +#define LUSTRE_PATCH 56#define LUSTRE_FIX 0 -#define LUSTRE_VERSION_STRING "2.14.55" +#define LUSTRE_VERSION_STRING "2.14.56"#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/13 lustre: sec: no encryption key migrate/extend/resync/split
In reply to James SimmonsFrom: Sebastien Buisson <[email protected]>
Allow some layout operations on encrypted files, even when the encryption key is not available:
- lfs migrate
- lfs mirror extend
- lfs mirror resync
- lfs mirror verify
- lfs mirror split
We allow these access patterns to applications that know what they are doing, by using the specific flag O_FILE_ENC and O_DIRECT.
WC-bug-id: https://jira.whamcloud.com/browse/LU-14677
Lustre-commit: fdbf2ffd41fa56607 ("LU-14677 sec: no encryption key migrate/extend/resync/split")
Reviewed-on: https://review.whamcloud.com/44024
--- fs/lustre/include/obd.h | 1 - fs/lustre/llite/crypto.c | 55 +++++++++++++--- fs/lustre/llite/dir.c | 13 +++- fs/lustre/llite/file.c | 49 +++++++++----- fs/lustre/llite/llite_internal.h | 10 ++- fs/lustre/llite/llite_lib.c | 109 ++++++++++++++++++++++++++++++-- fs/lustre/llite/namei.c | 64 +++++++++---------- fs/lustre/llite/rw26.c | 2 +- fs/lustre/llite/xattr.c | 4 +- fs/lustre/osc/osc_request.c | 42 +++++++++--- include/uapi/linux/lustre/lustre_user.h | 4 ++ 11 files changed, 273 insertions(+), 80 deletions(-)
fs/lustre/include/obd.h +0 -1
@@ -734,7 +734,6 @@ enum md_op_code {LUSTRE_OPC_ANY ,LUSTRE_OPC_LOOKUP , LUSTRE_OPC_OPEN, - LUSTRE_OPC_MIGR, };/**
fs/lustre/llite/crypto.c +46 -9
105 lines not on this page · raw message
fs/lustre/llite/dir.c +11 -2
@@ -1805,7 +1805,12 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg) st.st_uid = body->mbo_uid; st.st_gid = body->mbo_gid; st.st_rdev = body->mbo_rdev; - st.st_size = body->mbo_size; +if (fscrypt_require_key (inode) == -ENOKEY ) + st.st_size =round_up (st.st_size, +LUSTRE_ENCRYPTION_UNIT_SIZE ); +else + st.st_size = body->mbo_size; + st.st_blksize =PAGE_SIZE ; st.st_blocks = body->mbo_blocks; st.st_atime = body->mbo_atime;
@@ -1829,7 +1834,11 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg) stx.stx_mode = body->mbo_mode; stx.stx_ino =cl_fid_build_ino (&body->mbo_fid1, api32); - stx.stx_size = body->mbo_size; +if (fscrypt_require_key (inode) == -ENOKEY ) + stx.stx_size =round_up (stx.stx_size, +LUSTRE_ENCRYPTION_UNIT_SIZE ); +else + stx.stx_size = body->mbo_size; stx.stx_blocks = body->mbo_blocks; stx.stx_atime.tv_sec = body->mbo_atime; stx.stx_ctime.tv_sec = body->mbo_ctime;
fs/lustre/llite/file.c +33 -16
87 lines not on this page · raw message
fs/lustre/llite/llite_internal.h +9 -1
@@ -1184,6 +1184,8 @@ int ll_revalidate_it_finish(struct ptlrpc_request *request,struct inode *ll_inode_from_resource_lock (struct ldlm_lock *lock);void ll_dir_clear_lsm_md (struct inode *inode);void ll_clear_inode (struct inode *inode); +int volatile_ref_file (const char *volatile_name,int volatile_len, +struct file **ref_file);int ll_setattr_raw (struct dentry *dentry,struct iattr *attr,enum op_xvalid xvalid,bool hsm_import);int ll_setattr (struct dentry *de,struct iattr *attr);
@@ -1707,7 +1709,7 @@ static inline struct pcc_super *ll_info2pccs(struct ll_inode_info *lli) #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, llcrypt does not compute a digested form of this digest. + * That way, fscrypt does not compute a digested form of this digest. */ struct ll_digest_filename { struct lu_fid ldf_fid;
@@ -1722,6 +1724,7 @@ int ll_fname_disk_to_usr(struct inode *inode, struct fscrypt_str *iname, struct fscrypt_str *oname, struct lu_fid *fid);int ll_revalidate_d_crypto (struct dentry *dentry,unsigned int flags); +int ll_file_open_encrypt (struct inode *inode,struct file *filp);#else int ll_setup_filename (struct inode *dir,const struct qstr *iname,int lookup,struct fscrypt_name *fname)
@@ -1740,6 +1743,11 @@ int ll_revalidate_d_crypto(struct dentry *dentry, unsigned int flags) {return 1 ; } + +int ll_file_open_encrypt (struct inode *inode,struct file *filp) +{ +return 0 ; +}#endif extern const struct fscrypt_operations lustre_cryptops;
fs/lustre/llite/llite_lib.c +104 -5
153 lines not on this page · raw message
fs/lustre/llite/namei.c +30 -34
109 lines not on this page · raw message
fs/lustre/llite/rw26.c +1 -1
@@ -257,7 +257,7 @@ struct ll_dio_pages {if (inode &&IS_ENCRYPTED (inode)) {/* In case of Direct IO on encrypted file, we need to * add a reference to the inode on the cl_page. -* This info is required by llcrypt to proceed +* This info is required by fscrypt to proceed * to encryption/decryption. * This is safe because we know these pages are private * to the thread doing the Direct IO.
fs/lustre/llite/xattr.c +2 -2
@@ -365,7 +365,7 @@ int ll_xattr_list(struct inode *inode, const char *name, int type, void *buffer,int rc;/* Getting LL_XATTR_NAME_ENCRYPTION_CONTEXT xattr is only allowed -* when it comes from ll_get_context(), ie when llcrypt needs to +* when it comes from ll_get_context(), ie when fscrypt needs to * know the encryption context. * Otherwise, any direct reading of this xattr returns -EPERM. */
@@ -646,7 +646,7 @@ ssize_t ll_listxattr(struct dentry *dentry, char *buffer, size_t size)/* Listing xattrs should not expose * LL_XATTR_NAME_ENCRYPTION_CONTEXT xattr, unless it comes -* from llcrypt. +* from fscrypt. */ if (get_xattr_type (xattr_name)->flags ==XATTR_SECURITY_T && !strcmp (xattr_name,LL_XATTR_NAME_ENCRYPTION_CONTEXT )) {
fs/lustre/osc/osc_request.c +33 -9
70 lines not on this page · raw message
include/uapi/linux/lustre/lustre_user.h +4 -0
@@ -399,6 +399,10 @@ struct ll_ioc_lease_id {* devices and are safe for use on new files (See LU-812, LU-4209). */ #define O_LOV_DELAY_CREATE (O_NOCTTY | FASYNC) +/* O_FILE_ENC principle is similar to O_LOV_DELAY_CREATE above, +* for access to encrypted files without the encryption key. +*/ +#define O_FILE_ENC (O_NOCTTY | O_NDELAY)#define LL_FILE_IGNORE_LOCK 0x00000001#define LL_FILE_GROUP_LOCKED 0x00000002
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/13 lustre: sec: fix handling of encrypted file with long name
In reply to James SimmonsFrom: Sebastien Buisson <[email protected]>
The ciphertext representation of the name of an encrypted file or directory can be up to 256 bytes of binary data, if the cleartext name is up to NAME_MAX. But then this ciphertext is encoded via critical_encode() before being sent to servers. Once encoded, the length can exceed NAME_MAX because of the escaped critical characters.
So make sure ll_prep_md_op_data() accepts those too long encoded names if it is called for lookup or create of an encrypted file or directory. In the other cases, the 'name' taken as input is the plain text version, so it must conform to the NAME_MAX limit.
When carrying out operations on an encrypted file with long name, we manipulate a digested form whose hash needs to be matched against the content of the LinkEA. The name found in the LinkEA is not NUL terminated, so this aspect must be taken care of.
WC-bug-id: https://jira.whamcloud.com/browse/LU-13717
Lustre-commit: 75414af6bf310244d ("LU-13717 sec: fix handling of encrypted file with long name")
Reviewed-on: https://review.whamcloud.com/45163
--- fs/lustre/llite/llite_lib.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/lustre/llite/llite_lib.c +3 -1
@@ -3110,7 +3110,9 @@ struct md_op_data *ll_prep_md_op_data(struct md_op_data *op_data,if (namelen)return ERR_PTR (-EINVAL ); }else { -if (namelen >ll_i2sbi (i1)->ll_namelen) +if ((!IS_ENCRYPTED (i1) || + (opc !=LUSTRE_OPC_LOOKUP && opc !=LUSTRE_OPC_CREATE )) && + namelen >ll_i2sbi (i1)->ll_namelen)return ERR_PTR (-ENAMETOOLONG );/* "/" is not valid name, but it's allowed */
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/13 lnet: socklnd: expect two control connections maximum
In reply to James SimmonsFrom: Serguei Smirnov <[email protected]>
As a result of connecting to ourselves, e.g. pinging own nid, two control type connections are established vs. just one in case of connecting externally.
Fix the control connection counter to be able to handle that.
WC-bug-id: https://jira.whamcloud.com/browse/LU-15137
Lustre-commit: ee9a03d8308c5918a ("LU-15137 socklnd: expect two control connections maximum")
Reviewed-on: https://review.whamcloud.com/45461
--- net/lnet/klnds/socklnd/socklnd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/lnet/klnds/socklnd/socklnd.h +1 -1
@@ -397,7 +397,7 @@ struct ksock_conn_cb {* type */ unsigned int ksnr_deleted:1; /* been removed from peer_ni? */ - unsigned int ksnr_ctrl_conn_count:1; /* # conns by type */ + unsigned int ksnr_ctrl_conn_count:2; /* # conns by type */ unsigned int ksnr_blki_conn_count:8; unsigned int ksnr_blko_conn_count:8;int ksnr_conn_count;/* total # conns for
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/13 lustre: ptlrpc: use a cached value
In reply to James SimmonsFrom: Alexey Lyashkov <[email protected]>
Don't calculate a early reply size - use a cached, as it don't changed after start
WC-bug-id: https://jira.whamcloud.com/browse/LU-15279
Lustre-commit: d6a3b0529d7da440a ("LU-15279 ptlrpc: use a cached value")
Reviewed-on: https://review.whamcloud.com/45661
--- fs/lustre/include/lustre_net.h | 2 +- fs/lustre/mdc/mdc_locks.c | 4 ++-- fs/lustre/ptlrpc/pack_generic.c | 8 +++++--- fs/lustre/ptlrpc/ptlrpc_internal.h | 1 + fs/lustre/ptlrpc/ptlrpc_module.c | 1 + fs/lustre/ptlrpc/sec_null.c | 4 ++-- fs/lustre/ptlrpc/sec_plain.c | 2 +- 7 files changed, 13 insertions(+), 9 deletions(-)
fs/lustre/include/lustre_net.h +1 -1
@@ -2010,7 +2010,7 @@ int lustre_shrink_msg(struct lustre_msg *msg, int segment,u32 lustre_msg_size (u32 magic,int count,u32 *lengths);u32 lustre_msg_size_v2 (int count,u32 *lengths);u32 lustre_packed_msg_size (struct lustre_msg *msg); -u32 lustre_msg_early_size (void ); +extern u32 lustre_msg_early_size;void *lustre_msg_buf_v2 (struct lustre_msg_v2 *m,u32 n,u32 min_size);void *lustre_msg_buf (struct lustre_msg *m,u32 n,u32 minlen);u32 lustre_msg_buflen (struct lustre_msg *m,u32 n);
fs/lustre/mdc/mdc_locks.c +2 -2
@@ -397,7 +397,7 @@ static int mdc_save_lovea(struct ptlrpc_request *req, void *data, u32 size)/* Get real repbuf allocated size as rounded up power of 2 */ repsize =size_roundup_power2 (req->rq_replen + -lustre_msg_early_size ()); + lustre_msg_early_size);/* Estimate free space for DoM files in repbuf */ repsize_estimate = repsize - (req->rq_replen - mdt_md_capsule_size +
@@ -415,7 +415,7 @@ static int mdc_save_lovea(struct ptlrpc_request *req, void *data, u32 size)CDEBUG (D_INFO ,"Increase repbuf by %d bytes, total: %d\n" , repsize, req->rq_replen); repsize =size_roundup_power2 (req->rq_replen + -lustre_msg_early_size ()); + lustre_msg_early_size); }/* The only way to report real allocated repbuf size to the server * is the lm_repsize but it must be set prior buffer allocation itself
fs/lustre/ptlrpc/pack_generic.c +5 -3
@@ -72,14 +72,16 @@ u32 lustre_msg_hdr_size(u32 magic, u32 count) } } +u32 lustre_msg_early_size; +EXPORT_SYMBOL (lustre_msg_early_size); +/* early reply size */ -u32 lustre_msg_early_size (void ) +void lustre_msg_early_size_init (void ) {u32 pblen =sizeof (struct ptlrpc_body ); -return lustre_msg_size (LUSTRE_MSG_MAGIC_V2 ,1 , &pblen); + lustre_msg_early_size =lustre_msg_size (LUSTRE_MSG_MAGIC_V2 ,1 , &pblen); } -EXPORT_SYMBOL (lustre_msg_early_size);u32 lustre_msg_size_v2 (int count,u32 *lengths) {
fs/lustre/ptlrpc/ptlrpc_internal.h +1 -0
@@ -244,6 +244,7 @@ void ptlrpc_fill_bulk_md(struct lnet_md *md, struct ptlrpc_bulk_desc *desc,struct ptlrpc_reply_state *lustre_get_emerg_rs (struct ptlrpc_service_part *svcpt);void lustre_put_emerg_rs (struct ptlrpc_reply_state *rs); +void lustre_msg_early_size_init (void );/* just for init */ /* pinger.c */ int ptlrpc_start_pinger (void );
fs/lustre/ptlrpc/ptlrpc_module.c +1 -0
@@ -85,6 +85,7 @@ static int __init ptlrpc_init(void)mutex_init (&pinger_mutex);mutex_init (&ptlrpcd_mutex);ptlrpc_init_xid (); +lustre_msg_early_size_init (); rc =libcfs_setup ();if (rc)
fs/lustre/ptlrpc/sec_null.c +2 -2
@@ -195,7 +195,7 @@ int null_alloc_repbuf(struct ptlrpc_sec *sec, int msgsize) {/* add space for early replied */ - msgsize +=lustre_msg_early_size (); + msgsize += lustre_msg_early_size; msgsize =size_roundup_power2 (msgsize);
@@ -367,7 +367,7 @@ int null_authorize(struct ptlrpc_request *req)if (likely (req->rq_packed_final)) {if (lustre_msghdr_get_flags (req->rq_reqmsg) &MSGHDR_AT_SUPPORT ) - req->rq_reply_off =lustre_msg_early_size (); + req->rq_reply_off = lustre_msg_early_size; }else {u32 cksum;
fs/lustre/ptlrpc/sec_plain.c +1 -1
@@ -996,7 +996,7 @@ int sptlrpc_plain_init(void)u32 buflens[PLAIN_PACK_SEGMENTS ] = {0 , };int rc; - buflens[PLAIN_PACK_MSG_OFF ] =lustre_msg_early_size (); + buflens[PLAIN_PACK_MSG_OFF ] = lustre_msg_early_size; plain_at_offset =lustre_msg_size_v2 (PLAIN_PACK_SEGMENTS , buflens); rc =sptlrpc_register_policy (&plain_policy);
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/13 lnet: Race on discovery queue
In reply to James SimmonsFrom: Chris Horn <[email protected]>
If the discovery thread clears the LNET_PEER_DISCOVERING bit then a race window opens when the discovery thread drops the lnet_peer.lp_lock spinlock and closes when the discovery thread acquires the lnet_net_lock. If another thread queues the peer for discovery during this window then the LNET_PEER_DISCOVERING bit is added back to the peer state, but since the peer is already on the lnet.ln_dc_working queue, it does not get added to the lnet.ln_dc_request queue.
When the discovery thread acquires the lnet_net_lock/EX, it sees that the LNET_PEER_DISCOVERING bit has not been cleared, so it does not call lnet_peer_discovery_complete() which is responsible for sending messages on the peer's discovery pending queue.
At this point, the peer is stuck on the lnet.ln_dc_working queue, and messages may continue to accumulate on the peer's lnet_peer.lp_dc_pendq.
Fix the issue by re-working the main discovery thread loop so that we do not release the lnet_peer.lp_lock until after we've determined whether we need to call lnet_peer_discovery_complete(). This ensures that the lnet_peer is correctly removed from the discovery work queue and any messages on the peer's lnet_peer.lp_dc_pendq are sent or finalized.
It is also possible for the lnet_peer.lp_dc_error to be cleared during the aforementioned window, as well as during the time when lnet_peer_discovery_complete() is processing the contents of the lnet_peer.lp_dc_pendq. This could prevent messages on the lnet_peer.lp_dc_pendq from being correctly finalized. To fix this issue, the responsibilities of lnet_peer_discovery_error() were incorporated into lnet_peer_discovery_complete().
HPE-bug-id: LUS-10615
WC-bug-id: https://jira.whamcloud.com/browse/LU-15234
Lustre-commit: 852a4b264a984979d ("LU-15234 lnet: Race on discovery queue")
Reviewed-on: https://review.whamcloud.com/45670
--- net/lnet/lnet/peer.c | 47 ++++++++++++++++++++--------------------------- 1 file changed, 20 insertions(+), 27 deletions(-)
net/lnet/lnet/peer.c +20 -27
@@ -2262,7 +2262,7 @@ static int lnet_peer_queue_for_discovery(struct lnet_peer *lp)* Discovery of a peer is complete. Wake all waiters on the peer. * Call with lnet_net_lock/EX held. */ -static void lnet_peer_discovery_complete (struct lnet_peer *lp) +static void lnet_peer_discovery_complete (struct lnet_peer *lp,int dc_error) {struct lnet_msg *msg, *tmp;int rc =0 ;
@@ -2273,6 +2273,11 @@ static void lnet_peer_discovery_complete(struct lnet_peer *lp)list_del_init (&lp->lp_dc_list);spin_lock (&lp->lp_lock); +if (dc_error) { + lp->lp_dc_error = dc_error; + lp->lp_state &= ~LNET_PEER_DISCOVERING ; + lp->lp_state |=LNET_PEER_REDISCOVER ; + }list_splice_init (&lp->lp_dc_pendq, &pending_msgs);spin_unlock (&lp->lp_lock);wake_up (&lp->lp_dc_waitq);
@@ -2285,8 +2290,8 @@ static void lnet_peer_discovery_complete(struct lnet_peer *lp)/* iterate through all pending messages and send them again */ list_for_each_entry_safe (msg, tmp, &pending_msgs, msg_list) {list_del_init (&msg->msg_list); -if (lp->lp_dc_error) { -lnet_finalize (msg, lp->lp_dc_error); +if (dc_error) { +lnet_finalize (msg, dc_error);continue ; }
@@ -3619,22 +3624,6 @@ static int lnet_peer_send_push(struct lnet_peer *lp) }/* -* An unrecoverable error was encountered during discovery. -* Set error status in peer and abort discovery. -*/ -static void lnet_peer_discovery_error (struct lnet_peer *lp,int error) -{ -CDEBUG (D_NET ,"Discovery error %s: %d\n" , -libcfs_nidstr (&lp->lp_primary_nid), error); - -spin_lock (&lp->lp_lock); - lp->lp_dc_error = error; - lp->lp_state &= ~LNET_PEER_DISCOVERING ; - lp->lp_state |=LNET_PEER_REDISCOVER ; -spin_unlock (&lp->lp_lock); -} - -/* * Wait for work to be queued or some other change that must be * attended to. Returns non-zero if the discovery thread should shut * down.
@@ -3810,17 +3799,22 @@ static int lnet_peer_discovery(void *arg)CDEBUG (D_NET ,"peer %s(%p) state %#x rc %d\n" ,libcfs_nidstr (&lp->lp_primary_nid), lp, lp->lp_state, rc); -spin_unlock (&lp->lp_lock); -lnet_net_lock (LNET_LOCK_EX );if (rc ==LNET_REDISCOVER_PEER ) { +spin_unlock (&lp->lp_lock); +lnet_net_lock (LNET_LOCK_EX );list_move (&lp->lp_dc_list, &the_lnet.ln_dc_request); - }else if (rc) { -lnet_peer_discovery_error (lp, rc); + }else if (rc || + !(lp->lp_state &LNET_PEER_DISCOVERING )) { +spin_unlock (&lp->lp_lock); +lnet_net_lock (LNET_LOCK_EX ); +lnet_peer_discovery_complete (lp, rc); + }else { +spin_unlock (&lp->lp_lock); +lnet_net_lock (LNET_LOCK_EX ); } -if (!(lp->lp_state &LNET_PEER_DISCOVERING )) -lnet_peer_discovery_complete (lp); +if (the_lnet.ln_dc_state ==LNET_DC_STATE_STOPPING )break ; }
@@ -3857,8 +3851,7 @@ static int lnet_peer_discovery(void *arg)while (!list_empty (&the_lnet.ln_dc_request)) { lp =list_first_entry (&the_lnet.ln_dc_request, struct lnet_peer, lp_dc_list); -lnet_peer_discovery_error (lp, -ESHUTDOWN ); -lnet_peer_discovery_complete (lp); +lnet_peer_discovery_complete (lp, -ESHUTDOWN ); }lnet_net_unlock (LNET_LOCK_EX );
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/13 lnet: o2iblnd: convert ibp_refcount to a kref
In reply to James SimmonsThis refcount is used exactly like a kref. So change it to one. kref uses refcount_t which will warn on increment-from-zero and similar problems (which enabled with CONFIG option), so we don't need the LASSERT calls.
WC-bug-id: https://jira.whamcloud.com/browse/LU-12678
Lustre-commit: 2968a40a163aa1b0f ("LU-12678 o2iblnd: convert ibp_refcount to a kref")
Reviewed-on: https://review.whamcloud.com/45685
--- net/lnet/klnds/o2iblnd/o2iblnd.c | 11 ++++++----- net/lnet/klnds/o2iblnd/o2iblnd.h | 35 +++++++++++++++++------------------ 2 files changed, 23 insertions(+), 23 deletions(-)
net/lnet/klnds/o2iblnd/o2iblnd.c +6 -5
@@ -337,7 +337,7 @@ int kiblnd_create_peer(struct lnet_ni *ni, struct kib_peer_ni **peerp, peer_ni->ibp_max_frags =IBLND_MAX_RDMA_FRAGS ; 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 */ -atomic_set (&peer_ni->ibp_refcount,1 );/* 1 ref for caller */ +kref_init (&peer_ni->ibp_kref);INIT_HLIST_NODE (&peer_ni->ibp_list);INIT_LIST_HEAD (&peer_ni->ibp_conns);
@@ -357,12 +357,13 @@ int kiblnd_create_peer(struct lnet_ni *ni, struct kib_peer_ni **peerp,return 0 ; } -void kiblnd_destroy_peer (struct kib_peer_ni *peer_ni) +void kiblnd_destroy_peer (struct kref *kref) { + struct kib_peer_ni *peer_ni = container_of(kref, struct kib_peer_ni, + ibp_kref);struct kib_net *net = peer_ni->ibp_ni->ni_data;LASSERT (net); -LASSERT (!atomic_read (&peer_ni->ibp_refcount));LASSERT (!kiblnd_peer_active (peer_ni));LASSERT (kiblnd_peer_idle (peer_ni));LASSERT (list_empty (&peer_ni->ibp_tx_queue));
@@ -403,7 +404,7 @@ struct kib_peer_ni *kiblnd_find_peer_locked(struct lnet_ni *ni, lnet_nid_t nid)CDEBUG (D_NET ,"got peer_ni [%p] -> %s (%d) version: %x\n" , peer_ni,libcfs_nid2str (nid), -atomic_read (&peer_ni->ibp_refcount), +kref_read (&peer_ni->ibp_kref), peer_ni->ibp_version);return peer_ni; }
@@ -439,7 +440,7 @@ static int kiblnd_get_peer_info(struct lnet_ni *ni, int index,continue ; *nidp = peer_ni->ibp_nid; - *count =atomic_read (&peer_ni->ibp_refcount); + *count =kref_read (&peer_ni->ibp_kref);read_unlock_irqrestore (&kiblnd_data.kib_global_lock, flags);return 0 ;
net/lnet/klnds/o2iblnd/o2iblnd.h +17 -18
@@ -499,7 +499,7 @@ struct kib_peer_ni {/* when (in seconds) I was last alive */ time64_t ibp_last_alive;/* # users */ -atomic_t ibp_refcount; +struct kref ibp_kref;/* version of peer_ni */ u16 ibp_version;/* current passive connection attempts */
@@ -607,23 +607,23 @@ static inline int kiblnd_timeout(void) } \ }while (0 ) -#define kiblnd_peer_addref (peer_ni) \ -do { \ - CDEBUG(D_NET, "peer_ni[%p] -> %s (%d)++\n", \ - (peer_ni), libcfs_nid2str((peer_ni)->ibp_nid), \ - atomic_read(&(peer_ni)->ibp_refcount)); \ - atomic_inc(&(peer_ni)->ibp_refcount); \ -} while (0) +void kiblnd_destroy_peer(struct kref *kref); -#define kiblnd_peer_decref (peer_ni) \ -do { \ - CDEBUG(D_NET, "peer_ni[%p] -> %s (%d)--\n", \ - (peer_ni), libcfs_nid2str((peer_ni)->ibp_nid), \ - atomic_read(&(peer_ni)->ibp_refcount)); \ - LASSERT_ATOMIC_POS(&(peer_ni)->ibp_refcount); \ - if (atomic_dec_and_test(&(peer_ni)->ibp_refcount)) \ - kiblnd_destroy_peer(peer_ni); \ -} while (0) +static inline void kiblnd_peer_addref (struct kib_peer_ni *peer_ni) +{ +CDEBUG (D_NET ,"peer_ni[%p] -> %s (%d)++\n" , + peer_ni,libcfs_nid2str (peer_ni->ibp_nid), +kref_read (&peer_ni->ibp_kref)); +kref_get (&(peer_ni)->ibp_kref); +} + +static inline void kiblnd_peer_decref (struct kib_peer_ni *peer_ni) +{ +CDEBUG (D_NET ,"peer_ni[%p] -> %s (%d)--\n" , + peer_ni,libcfs_nid2str (peer_ni->ibp_nid), +kref_read (&peer_ni->ibp_kref)); +kref_put (&peer_ni->ibp_kref, kiblnd_destroy_peer); +}static inline bool kiblnd_peer_connecting (struct kib_peer_ni *peer_ni)
@@ -929,7 +929,6 @@ int kiblnd_cm_callback(struct rdma_cm_id *cmid,int kiblnd_dev_failover (struct kib_dev *dev,struct net *ns);int kiblnd_create_peer (struct lnet_ni *ni,struct kib_peer_ni **peerp,lnet_nid_t nid); -void kiblnd_destroy_peer (struct kib_peer_ni *peer_ni);bool kiblnd_reconnect_peer (struct kib_peer_ni *peer_ni);void kiblnd_destroy_dev (struct kib_dev *dev);void kiblnd_unlink_peer_locked (struct kib_peer_ni *peer_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 13/13 lustre: llite: set ra_pages of backing_dev_info with 0
In reply to James SimmonsFrom: Qian Yingjin <[email protected]>
The latest kernels sets initial @ra_pages ofbacking_dev_info with VM_READAHEAD_PAGES:
struct backing_dev_info *bdi_alloc(int node_id)
{
...
bdi->ra_pages = VM_READAHEAD_PAGES;
bdi->io_pages = VM_READAHEAD_PAGES;
...
}This will cause that @ra_pages of file readahead state is set with @bdi->ra_pages, make the readahead is out of Lustre control and trigger the readahead logic in Linux kernel wrongly. And it results in the failure sanity 101j.
In this patch, we force to set @ra_pages of backing_dev_info with 0 after setup the backing device info. By this way, it disables kernel readahead in the super block.
This patch also cleanups the unnecessary setting of @ra_pages in llite "file.c" and "vvp_io.c".
WC-bug-id: https://jira.whamcloud.com/browse/LU-15244
Lustre-commit: 878561880d2aba038 ("LU-15244 llite: set ra_pages of backing_dev_info with 0")
Reviewed-on: https://review.whamcloud.com/45712
--- fs/lustre/llite/file.c | 2 -- fs/lustre/llite/llite_lib.c | 3 +++ fs/lustre/llite/vvp_io.c | 3 --- 3 files changed, 3 insertions(+), 5 deletions(-)
fs/lustre/llite/file.c +0 -2
@@ -757,8 +757,6 @@ static int ll_local_open(struct file *file, struct lookup_intent *it, file->private_data = fd;ll_readahead_init (inode, &fd->fd_ras); fd->fd_omode = it->it_flags & (FMODE_READ |FMODE_WRITE |FMODE_EXEC ); -/* turn off the kernel's read-ahead */ - file->f_ra.ra_pages =0 ;return 0 ; }
fs/lustre/llite/llite_lib.c +3 -0
@@ -1203,6 +1203,9 @@ int ll_fill_super(struct super_block *sb)if (err) goto out_free; +/* disable kernel readahead */ + sb->s_bdi->ra_pages =0 ; +/* Call ll_debugsfs_register_super() before lustre_process_log() * so that "llite.*.*" params can be processed correctly. */
fs/lustre/llite/vvp_io.c +0 -3
@@ -834,9 +834,6 @@ static int vvp_io_read_start(const struct lu_env *env,"Read ino %lu, %zu bytes, offset %lld, size %llu\n" , inode->i_ino, cnt, pos, i_size_read(inode)); -/* turn off the kernel's read-ahead */ - vio->vui_fd->fd_file->f_ra.ra_pages =0 ; -/* initialize read-ahead window once per syscall */ if (!vio->vui_ra_valid) { vio->vui_ra_valid = true;
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org