Skip to content

Commit 913eca1

Browse files
amschuma-ntapTrond Myklebust
authored andcommitted
NFS: Fallocate should use the nfs4_fattr_bitmap
Changing a sparse file could have an effect not only on the file size, but also on the number of blocks used by the file in the underlying filesystem. The server's cache_consistency_bitmap doesn't update the SPACE_USED attribute, so let's switch to the nfs4_fattr_bitmap to catch this update whenever we do an ALLOCATE or DEALLOCATE. This patch fixes xfstests generic/568, which tests that fallocating an unaligned range allocates all blocks touched by that range. Without this patch, `stat` reports 0 bytes used immediately after the fallocate. Adding a `sleep 5` to the test also catches the update, but it's better to do so when we know something has changed. Signed-off-by: Anna Schumaker <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
1 parent 89658c4 commit 913eca1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/nfs/nfs42proc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ static int _nfs42_proc_fallocate(struct rpc_message *msg, struct file *filep,
4949
.falloc_fh = NFS_FH(inode),
5050
.falloc_offset = offset,
5151
.falloc_length = len,
52-
.falloc_bitmask = server->cache_consistency_bitmask,
52+
.falloc_bitmask = nfs4_fattr_bitmap,
5353
};
5454
struct nfs42_falloc_res res = {
5555
.falloc_server = server,

0 commit comments

Comments
 (0)