Commit 18fe6a23 authored by Anna Schumaker's avatar Anna Schumaker

NFS: Set FATTR4_WORD0_TYPE for . and .. entries

The current code worked okay for getdents(), but getdents64() expects
the d_type field to get filled out properly in the stat structure.
Setting this field fixes xfstests generic/401.
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
parent 800222f8
...@@ -275,6 +275,7 @@ const u32 nfs4_fs_locations_bitmap[3] = { ...@@ -275,6 +275,7 @@ const u32 nfs4_fs_locations_bitmap[3] = {
static void nfs4_setup_readdir(u64 cookie, __be32 *verifier, struct dentry *dentry, static void nfs4_setup_readdir(u64 cookie, __be32 *verifier, struct dentry *dentry,
struct nfs4_readdir_arg *readdir) struct nfs4_readdir_arg *readdir)
{ {
unsigned int attrs = FATTR4_WORD0_FILEID | FATTR4_WORD0_TYPE;
__be32 *start, *p; __be32 *start, *p;
if (cookie > 2) { if (cookie > 2) {
...@@ -305,8 +306,9 @@ static void nfs4_setup_readdir(u64 cookie, __be32 *verifier, struct dentry *dent ...@@ -305,8 +306,9 @@ static void nfs4_setup_readdir(u64 cookie, __be32 *verifier, struct dentry *dent
memcpy(p, ".\0\0\0", 4); /* entry */ memcpy(p, ".\0\0\0", 4); /* entry */
p++; p++;
*p++ = xdr_one; /* bitmap length */ *p++ = xdr_one; /* bitmap length */
*p++ = htonl(FATTR4_WORD0_FILEID); /* bitmap */ *p++ = htonl(attrs); /* bitmap */
*p++ = htonl(8); /* attribute buffer length */ *p++ = htonl(12); /* attribute buffer length */
*p++ = htonl(NF4DIR);
p = xdr_encode_hyper(p, NFS_FILEID(d_inode(dentry))); p = xdr_encode_hyper(p, NFS_FILEID(d_inode(dentry)));
} }
...@@ -317,8 +319,9 @@ static void nfs4_setup_readdir(u64 cookie, __be32 *verifier, struct dentry *dent ...@@ -317,8 +319,9 @@ static void nfs4_setup_readdir(u64 cookie, __be32 *verifier, struct dentry *dent
memcpy(p, "..\0\0", 4); /* entry */ memcpy(p, "..\0\0", 4); /* entry */
p++; p++;
*p++ = xdr_one; /* bitmap length */ *p++ = xdr_one; /* bitmap length */
*p++ = htonl(FATTR4_WORD0_FILEID); /* bitmap */ *p++ = htonl(attrs); /* bitmap */
*p++ = htonl(8); /* attribute buffer length */ *p++ = htonl(12); /* attribute buffer length */
*p++ = htonl(NF4DIR);
p = xdr_encode_hyper(p, NFS_FILEID(d_inode(dentry->d_parent))); p = xdr_encode_hyper(p, NFS_FILEID(d_inode(dentry->d_parent)));
readdir->pgbase = (char *)p - (char *)start; readdir->pgbase = (char *)p - (char *)start;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment