Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fuse: reflect cached blocksize if blocksize was changed

As pointed out by Miklos[1], in the fuse_update_get_attr() path, the
attributes returned to stat may be cached values instead of fresh ones
fetched from the server. In the case where the server returned a
modified blocksize value, we need to cache it and reflect it back to
stat if values are not re-fetched since we now no longer directly change
inode->i_blkbits.

Link: https://lore.kernel.org/linux-fsdevel/CAJfpeguCOxeVX88_zPd1hqziB_C+tmfuDhZP5qO2nKmnb-dTUA@mail.gmail.com/ [1]

Fixes: 542ede096e48 ("fuse: keep inode->i_blkbits constant")
Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>

authored by

Joanne Koong and committed by
Miklos Szeredi
79569946 1e08938c

+12
+1
fs/fuse/dir.c
··· 1377 1377 generic_fillattr(idmap, request_mask, inode, stat); 1378 1378 stat->mode = fi->orig_i_mode; 1379 1379 stat->ino = fi->orig_ino; 1380 + stat->blksize = 1 << fi->cached_i_blkbits; 1380 1381 if (test_bit(FUSE_I_BTIME, &fi->state)) { 1381 1382 stat->btime = fi->i_btime; 1382 1383 stat->result_mask |= STATX_BTIME;
+6
fs/fuse/fuse_i.h
··· 210 210 /** Reference to backing file in passthrough mode */ 211 211 struct fuse_backing *fb; 212 212 #endif 213 + 214 + /* 215 + * The underlying inode->i_blkbits value will not be modified, 216 + * so preserve the blocksize specified by the server. 217 + */ 218 + u8 cached_i_blkbits; 213 219 }; 214 220 215 221 /** FUSE inode state bits */
+5
fs/fuse/inode.c
··· 289 289 } 290 290 } 291 291 292 + if (attr->blksize) 293 + fi->cached_i_blkbits = ilog2(attr->blksize); 294 + else 295 + fi->cached_i_blkbits = inode->i_sb->s_blocksize_bits; 296 + 292 297 /* 293 298 * Don't set the sticky bit in i_mode, unless we want the VFS 294 299 * to check permissions. This prevents failures due to the