Whamcloud - gitweb
LU-3544 fid: do open-by-fid by default
[fs/lustre-release.git] / lustre / llite / llite_nfs.c
index 6fb3315..bc56fbf 100644 (file)
@@ -136,12 +136,18 @@ ll_iget_for_nfs(struct super_block *sb, struct lu_fid *fid, struct lu_fid *paren
                 RETURN(ERR_PTR(-ESTALE));
         }
 
-        /**
-         * It is an anonymous dentry without OST objects created yet.
-         * We have to find the parent to tell MDS how to init lov objects.
-         */
-       if (S_ISREG(inode->i_mode) && !ll_i2info(inode)->lli_has_smd &&
-           parent != NULL && !fid_is_zero(parent)) {
+       result = d_obtain_alias(inode);
+       if (IS_ERR(result)) {
+               iput(inode);
+               RETURN(result);
+       }
+
+       /**
+        * In case d_obtain_alias() found a disconnected dentry, always update
+        * lli_pfid to allow later operation (normally open) have parent fid,
+        * which may be used by MDS to create data.
+        */
+       if (parent != NULL) {
                struct ll_inode_info *lli = ll_i2info(inode);
 
                spin_lock(&lli->lli_lock);
@@ -149,12 +155,6 @@ ll_iget_for_nfs(struct super_block *sb, struct lu_fid *fid, struct lu_fid *paren
                spin_unlock(&lli->lli_lock);
        }
 
-       result = d_obtain_alias(inode);
-       if (IS_ERR(result)) {
-               iput(inode);
-               RETURN(result);
-       }
-
         RETURN(result);
 }