summaryrefslogtreecommitdiff
path: root/fs/buffer.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2024-04-02 10:11:35 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-04-10 16:38:13 +0200
commit4525a918f99a12089a8fc677f21b9ed66c4aed96 (patch)
tree4457b104487afddac5cdb7b434be7a326118106a /fs/buffer.c
parentcae44b9daa67789f08a0f0d5f909c2a8a7661d60 (diff)
cifs: Fix caching to try to do open O_WRONLY as rdwr on server
[ Upstream commit e9e62243a3e2322cf639f653a0b0a88a76446ce7 ] When we're engaged in local caching of a cifs filesystem, we cannot perform caching of a partially written cache granule unless we can read the rest of the granule. This can result in unexpected access errors being reported to the user. Fix this by the following: if a file is opened O_WRONLY locally, but the mount was given the "-o fsc" flag, try first opening the remote file with GENERIC_READ|GENERIC_WRITE and if that returns -EACCES, try dropping the GENERIC_READ and doing the open again. If that last succeeds, invalidate the cache for that file as for O_DIRECT. Fixes: 70431bfd825d ("cifs: Support fscache indexing rewrite") Signed-off-by: David Howells <dhowells@redhat.com> cc: Steve French <sfrench@samba.org> cc: Shyam Prasad N <nspmangalore@gmail.com> cc: Rohith Surabattula <rohiths.msft@gmail.com> cc: Jeff Layton <jlayton@kernel.org> cc: linux-cifs@vger.kernel.org cc: netfs@lists.linux.dev cc: linux-fsdevel@vger.kernel.org Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs/buffer.c')
0 files changed, 0 insertions, 0 deletions