Patch "afs: Avoid endless loop if file is larger than expected" has been added to the 6.3-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    afs: Avoid endless loop if file is larger than expected

to the 6.3-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     afs-avoid-endless-loop-if-file-is-larger-than-expect.patch
and it can be found in the queue-6.3 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 6f3e48bd04275c91c57ee3cdb838bea7d88c0b37
Author: Marc Dionne <marc.dionne@xxxxxxxxxxxx>
Date:   Fri Dec 2 10:19:42 2022 -0400

    afs: Avoid endless loop if file is larger than expected
    
    [ Upstream commit 9ea4eff4b6f4f36546d537a74da44fd3f30903ab ]
    
    afs_read_dir fetches an amount of data that's based on what the inode
    size is thought to be.  If the file on the server is larger than what
    was fetched, the code rechecks i_size and retries.  If the local i_size
    was not properly updated, this can lead to an endless loop of fetching
    i_size from the server and noticing each time that the size is larger on
    the server.
    
    If it is known that the remote size is larger than i_size, bump up the
    fetch size to that size.
    
    Fixes: f3ddee8dc4e2 ("afs: Fix directory handling")
    Signed-off-by: Marc Dionne <marc.dionne@xxxxxxxxxxxx>
    Signed-off-by: David Howells <dhowells@xxxxxxxxxx>
    cc: linux-afs@xxxxxxxxxxxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/afs/dir.c b/fs/afs/dir.c
index 82690d1dd49a0..a97499fd747b6 100644
--- a/fs/afs/dir.c
+++ b/fs/afs/dir.c
@@ -275,6 +275,7 @@ static struct afs_read *afs_read_dir(struct afs_vnode *dvnode, struct key *key)
 	loff_t i_size;
 	int nr_pages, i;
 	int ret;
+	loff_t remote_size = 0;
 
 	_enter("");
 
@@ -289,6 +290,8 @@ static struct afs_read *afs_read_dir(struct afs_vnode *dvnode, struct key *key)
 
 expand:
 	i_size = i_size_read(&dvnode->netfs.inode);
+	if (i_size < remote_size)
+	    i_size = remote_size;
 	if (i_size < 2048) {
 		ret = afs_bad(dvnode, afs_file_error_dir_small);
 		goto error;
@@ -364,6 +367,7 @@ static struct afs_read *afs_read_dir(struct afs_vnode *dvnode, struct key *key)
 			 * buffer.
 			 */
 			up_write(&dvnode->validate_lock);
+			remote_size = req->file_size;
 			goto expand;
 		}
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux