From 67fe1d486a5b1ce35e280229f7e0223a4758d093 Mon Sep 17 00:00:00 2001 From: bobijam <bobijam> Date: Thu, 30 Aug 2007 03:54:40 +0000 Subject: [PATCH] Branch b1_6 b=13030 i=green, shadow Description: "ll_intent_file_open()) lock enqueue: err: -13" with nfs Details : with NFS, the anon dentry's parent was set to itself in d_alloc_anon(), so in MDS, we use rec->ur_fid1 to find the corresponding dentry other than use rec->ur_name. --- lustre/ChangeLog | 7 +++++++ lustre/llite/file.c | 2 +- lustre/llite/llite_nfs.c | 26 ++++++++++++++------------ lustre/mds/mds_open.c | 15 ++++++++++++++- 4 files changed, 36 insertions(+), 14 deletions(-) diff --git a/lustre/ChangeLog b/lustre/ChangeLog index bb040e6286..236ead4af9 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -115,6 +115,13 @@ Bugzilla : 13363 Description: test_7 on sanity-quota.sh can't be used on separate machines Details : add facet to handle it +Severity : normal +Bugzilla : 13030 +Description: "ll_intent_file_open()) lock enqueue: err: -13" with nfs +Details : with NFS, the anon dentry's parent was set to itself in + d_alloc_anon(), so in MDS, we use rec->ur_fid1 to find the + corresponding dentry other than use rec->ur_name. + -------------------------------------------------------------------------------- 2007-08-27 Cluster File Systems, Inc. <info@clusterfs.com> diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 6d669e2389..fa47d3bd55 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -296,7 +296,7 @@ static int ll_intent_file_open(struct file *file, void *lmm, if (rc != 0 || it_open_error(DISP_OPEN_OPEN, itp)) { rc = rc ? rc : it_open_error(DISP_OPEN_OPEN, itp); - CERROR("lock enqueue: err: %d\n", rc); + CDEBUG(D_VFSTRACE, "lock enqueue: err: %d\n", rc); GOTO(out, rc); } diff --git a/lustre/llite/llite_nfs.c b/lustre/llite/llite_nfs.c index 123fef6209..2f9add926a 100644 --- a/lustre/llite/llite_nfs.c +++ b/lustre/llite/llite_nfs.c @@ -63,15 +63,16 @@ static struct inode * search_inode_for_lustre(struct super_block *sb, int eadatalen = 0, rc; struct inode *inode = NULL; struct ll_fid iid = { .id = ino, .generation = generation }; + ENTRY; inode = ILOOKUP(sb, ino, ll_nfs_test_inode, &iid); if (inode) - return inode; + RETURN(inode); if (S_ISREG(mode)) { rc = ll_get_max_mdsize(sbi, &eadatalen); if (rc) - return ERR_PTR(rc); + RETURN(ERR_PTR(rc)); valid |= OBD_MD_FLEASIZE; } fid.id = (__u64)ino; @@ -81,17 +82,17 @@ static struct inode * search_inode_for_lustre(struct super_block *sb, rc = mdc_getattr(sbi->ll_mdc_exp, &fid, valid, eadatalen, &req); if (rc) { CERROR("failure %d inode %lu\n", rc, ino); - return ERR_PTR(rc); + RETURN(ERR_PTR(rc)); } rc = ll_prep_inode(sbi->ll_osc_exp, &inode, req, REPLY_REC_OFF, sb); if (rc) { ptlrpc_req_finished(req); - return ERR_PTR(rc); + RETURN(ERR_PTR(rc)); } ptlrpc_req_finished(req); - return inode; + RETURN(inode); } extern struct dentry_operations ll_d_ops; @@ -104,13 +105,14 @@ static struct dentry *ll_iget_for_nfs(struct super_block *sb, unsigned long ino, #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) struct list_head *lp; #endif + ENTRY; if (ino == 0) - return ERR_PTR(-ESTALE); + RETURN(ERR_PTR(-ESTALE)); inode = search_inode_for_lustre(sb, ino, generation, mode); if (IS_ERR(inode)) { - return ERR_PTR(PTR_ERR(inode)); + RETURN(ERR_PTR(PTR_ERR(inode))); } if (is_bad_inode(inode) || (generation && inode->i_generation != generation)){ @@ -120,14 +122,14 @@ static struct dentry *ll_iget_for_nfs(struct super_block *sb, unsigned long ino, atomic_read(&inode->i_count), inode->i_generation, generation); iput(inode); - return ERR_PTR(-ESTALE); + RETURN(ERR_PTR(-ESTALE)); } #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) result = d_alloc_anon(inode); if (!result) { iput(inode); - return ERR_PTR(-ENOMEM); + RETURN(ERR_PTR(-ENOMEM)); } #else /* now to find a dentry. @@ -143,7 +145,7 @@ static struct dentry *ll_iget_for_nfs(struct super_block *sb, unsigned long ino, unlock_dentry(result); spin_unlock(&dcache_lock); iput(inode); - return result; + RETURN(result); } unlock_dentry(result); } @@ -151,14 +153,14 @@ static struct dentry *ll_iget_for_nfs(struct super_block *sb, unsigned long ino, result = d_alloc_root(inode); if (result == NULL) { iput(inode); - return ERR_PTR(-ENOMEM); + RETURN(ERR_PTR(-ENOMEM)); } result->d_flags |= DCACHE_DISCONNECTED; #endif ll_set_dd(result); result->d_op = &ll_d_ops; - return result; + RETURN(result); } struct dentry *ll_fh_to_dentry(struct super_block *sb, __u32 *data, int len, diff --git a/lustre/mds/mds_open.c b/lustre/mds/mds_open.c index 0c2f6edaae..12e0ea451b 100644 --- a/lustre/mds/mds_open.c +++ b/lustre/mds/mds_open.c @@ -982,7 +982,20 @@ int mds_open(struct mds_update_record *rec, int offset, } /* Step 2: Lookup the child */ - dchild = ll_lookup_one_len(rec->ur_name, dparent, rec->ur_namelen - 1); + + if (!(lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY) && + (rec->ur_flags & MDS_OPEN_LOCK) && (rec->ur_namelen == 1)) { + /* hack for nfsd with no_subtree_check, it will use anon + * dentry w/o filename to open the file. the anon dentry's + * parent was set to itself, so rec->ur_fid1 is the file. + * And in MDC it cannot derive the dentry's parent dentry, + * hence the file's name, so we hack here in MDS, + * refer to bug 13030. */ + dchild = mds_fid2dentry(mds, rec->ur_fid1, NULL); + } else { + dchild = ll_lookup_one_len(rec->ur_name, dparent, + rec->ur_namelen - 1); + } if (IS_ERR(dchild)) { rc = PTR_ERR(dchild); dchild = NULL; /* don't confuse mds_finish_transno() below */ -- GitLab