]> err.no Git - linux-2.6/blobdiff - fs/nfsd/nfs4xdr.c
nfsd: clarify readdir/mountpoint-crossing code
[linux-2.6] / fs / nfsd / nfs4xdr.c
index 0e6a179eccaf99e7635b31284cc04614fc5604bb..1ba7ad981935d6f455d5c3185c78ba0842913898 100644 (file)
@@ -1867,6 +1867,15 @@ out_serverfault:
        goto out;
 }
 
+static inline int attributes_need_mount(u32 *bmval)
+{
+       if (bmval[0] & ~(FATTR4_WORD0_RDATTR_ERROR | FATTR4_WORD0_LEASE_TIME))
+               return 1;
+       if (bmval[1] & ~FATTR4_WORD1_MOUNTED_ON_FILEID)
+               return 1;
+       return 0;
+}
+
 static __be32
 nfsd4_encode_dirent_fattr(struct nfsd4_readdir *cd,
                const char *name, int namlen, __be32 *p, int *buflen)
@@ -1888,9 +1897,7 @@ nfsd4_encode_dirent_fattr(struct nfsd4_readdir *cd,
         * we will not follow the cross mount and will fill the attribtutes
         * directly from the mountpoint dentry.
         */
-       if (d_mountpoint(dentry) &&
-           (cd->rd_bmval[0] & ~FATTR4_WORD0_RDATTR_ERROR) == 0 &&
-           (cd->rd_bmval[1] & ~FATTR4_WORD1_MOUNTED_ON_FILEID) == 0)
+       if (d_mountpoint(dentry) && !attributes_need_mount(cd->rd_bmval))
                ignore_crossmnt = 1;
        else if (d_mountpoint(dentry)) {
                int err;