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.

Merge tag 'afs-fixes-20230502' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs

Pull AFS updates from David Howells:
"Three fixes to AFS directory handling:

- Make sure that afs_read_dir() sees any increase in file size if the
file unexpectedly changed on the server (e.g. due to another client
making a change).

- Make afs_getattr() always return the server's dir file size, not
the locally edited one, so that pagecache eviction doesn't cause
the dir file size to change unexpectedly.

- Prevent afs_read_dir() from getting into an endless loop if the
server indicates that the directory file size is larger than
expected"

* tag 'afs-fixes-20230502' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs:
afs: Avoid endless loop if file is larger than expected
afs: Fix getattr to report server i_size on dirs, not local size
afs: Fix updating of i_size with dv jump from server

+13 -1
+4
fs/afs/dir.c
··· 275 275 loff_t i_size; 276 276 int nr_pages, i; 277 277 int ret; 278 + loff_t remote_size = 0; 278 279 279 280 _enter(""); 280 281 ··· 290 289 291 290 expand: 292 291 i_size = i_size_read(&dvnode->netfs.inode); 292 + if (i_size < remote_size) 293 + i_size = remote_size; 293 294 if (i_size < 2048) { 294 295 ret = afs_bad(dvnode, afs_file_error_dir_small); 295 296 goto error; ··· 367 364 * buffer. 368 365 */ 369 366 up_write(&dvnode->validate_lock); 367 + remote_size = req->file_size; 370 368 goto expand; 371 369 } 372 370
+9 -1
fs/afs/inode.c
··· 230 230 set_bit(AFS_VNODE_ZAP_DATA, &vnode->flags); 231 231 } 232 232 change_size = true; 233 + data_changed = true; 233 234 } else if (vnode->status.type == AFS_FTYPE_DIR) { 234 235 /* Expected directory change is handled elsewhere so 235 236 * that we can locally edit the directory and save on a ··· 450 449 0 : FSCACHE_ADV_SINGLE_CHUNK, 451 450 &key, sizeof(key), 452 451 &aux, sizeof(aux), 453 - vnode->status.size)); 452 + i_size_read(&vnode->netfs.inode))); 454 453 #endif 455 454 } 456 455 ··· 777 776 if (test_bit(AFS_VNODE_SILLY_DELETED, &vnode->flags) && 778 777 stat->nlink > 0) 779 778 stat->nlink -= 1; 779 + 780 + /* Lie about the size of directories. We maintain a locally 781 + * edited copy and may make different allocation decisions on 782 + * it, but we need to give userspace the server's size. 783 + */ 784 + if (S_ISDIR(inode->i_mode)) 785 + stat->size = vnode->netfs.remote_i_size; 780 786 } while (need_seqretry(&vnode->cb_lock, seq)); 781 787 782 788 done_seqretry(&vnode->cb_lock, seq);