Skip to content

Commit 13fcc63

Browse files
committed
afs: Always include dir in bulk status fetch from afs_do_lookup()
When a lookup is done in an AFS directory, the filesystem will speculate and fetch up to 49 other statuses for files in the same directory and fetch those as well, turning them into inodes or updating inodes that already exist. However, occasionally, a callback break might go missing due to NAT timing out, but the afs filesystem doesn't then realise that the directory is not up to date. Alleviate this by using one of the status slots to check the directory in which the lookup is being done. Reported-by: Dave Botsch <[email protected]> Suggested-by: Jeffrey Altman <[email protected]> Signed-off-by: David Howells <[email protected]>
1 parent 32f71aa commit 13fcc63

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

fs/afs/dir.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,8 @@ static struct inode *afs_do_lookup(struct inode *dir, struct dentry *dentry,
658658

659659
cookie->ctx.actor = afs_lookup_filldir;
660660
cookie->name = dentry->d_name;
661-
cookie->nr_fids = 1; /* slot 0 is saved for the fid we actually want */
661+
cookie->nr_fids = 2; /* slot 0 is saved for the fid we actually want
662+
* and slot 1 for the directory */
662663

663664
read_seqlock_excl(&dvnode->cb_lock);
664665
dcbi = rcu_dereference_protected(dvnode->cb_interest,
@@ -709,7 +710,11 @@ static struct inode *afs_do_lookup(struct inode *dir, struct dentry *dentry,
709710
if (!cookie->inodes)
710711
goto out_s;
711712

712-
for (i = 1; i < cookie->nr_fids; i++) {
713+
cookie->fids[1] = dvnode->fid;
714+
cookie->statuses[1].cb_break = afs_calc_vnode_cb_break(dvnode);
715+
cookie->inodes[1] = igrab(&dvnode->vfs_inode);
716+
717+
for (i = 2; i < cookie->nr_fids; i++) {
713718
scb = &cookie->statuses[i];
714719

715720
/* Find any inodes that already exist and get their

0 commit comments

Comments
 (0)