Whamcloud - gitweb
LU-3544 nfs: writing to new files will return ENOENT 20/6920/4
authorPatrick Farrell <paf@cray.com>
Thu, 11 Jul 2013 16:06:27 +0000 (11:06 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 23 Jul 2013 05:22:28 +0000 (05:22 +0000)
This happend with SLES11SP2 Lustre client, which in turn acts as an
NFS server, exporting a subtree of an Lustre fs through NFS.

We detected that whenever we are writing to a new file using, fx,
'echo blah > newfile', it will return ENOENT error. We found
out that this was caused by the anonymous dentry. In SLESS11SP2,
anonymous dentries are assigned '/' as the name, instead of an
empty string. When MDT handles the intent_open call, it will look
up the obj by the name if it is not an empty string, and thus
couldn't find it.

As MDS_OPEN_BY_FID is always set on this request, we never need
to send the name in this request.  The fid is already available
and should be used in case the file has been renamed.

Signed-off-by: Cheng Shao <cheng_shao@xyratex.com>
Signed-off-by: Patrick Farrell <paf@cray.com>
Change-Id: Ia8bd6f2814d05350d0a197df8a3ffd9729e2081b
Reviewed-on: http://review.whamcloud.com/6920
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Tested-by: Hudson
Reviewed-by: Alexey Shvetsov <alexxy@gentoo.org>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/llite/file.c

index 066018e..87b30b4 100644 (file)
@@ -379,8 +379,6 @@ static int ll_intent_file_open(struct file *file, void *lmm,
 {
         struct ll_sb_info *sbi = ll_i2sbi(file->f_dentry->d_inode);
         struct dentry *parent = file->f_dentry->d_parent;
 {
         struct ll_sb_info *sbi = ll_i2sbi(file->f_dentry->d_inode);
         struct dentry *parent = file->f_dentry->d_parent;
-        const char *name = file->f_dentry->d_name.name;
-        const int len = file->f_dentry->d_name.len;
         struct md_op_data *op_data;
         struct ptlrpc_request *req;
         __u32 opc = LUSTRE_OPC_ANY;
         struct md_op_data *op_data;
         struct ptlrpc_request *req;
         __u32 opc = LUSTRE_OPC_ANY;
@@ -405,9 +403,10 @@ static int ll_intent_file_open(struct file *file, void *lmm,
                         opc = LUSTRE_OPC_CREATE;
         }
 
                         opc = LUSTRE_OPC_CREATE;
         }
 
-        op_data  = ll_prep_md_op_data(NULL, parent->d_inode,
-                                      file->f_dentry->d_inode, name, len,
-                                      O_RDWR, opc, NULL);
+       op_data  = ll_prep_md_op_data(NULL, parent->d_inode,
+                                     file->f_dentry->d_inode, NULL, 0,
+                                     O_RDWR, opc, NULL);
+
         if (IS_ERR(op_data))
                 RETURN(PTR_ERR(op_data));
 
         if (IS_ERR(op_data))
                 RETURN(PTR_ERR(op_data));