From: Zhang Tianci Date: Thu, 25 Dec 2025 11:11:56 +0000 (+0800) Subject: fuse: set ff->flock only on success X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=71947173cef279be5eed209ec28f8c11f9d73159;p=thirdparty%2Fkernel%2Flinux.git fuse: set ff->flock only on success If FUSE_SETLK fails (e.g., due to EWOULDBLOCK), we shall not set FUSE_RELEASE_FLOCK_UNLOCK in fuse_file_release(). Reported-by: Li Yichao Signed-off-by: Zhang Tianci Signed-off-by: Miklos Szeredi --- diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 8c8d9f6d8f724..9160836664b0a 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -2569,8 +2569,9 @@ static int fuse_file_flock(struct file *file, int cmd, struct file_lock *fl) struct fuse_file *ff = file->private_data; /* emulate flock with POSIX locks */ - ff->flock = true; err = fuse_setlk(file, fl, 1); + if (!err) + ff->flock = true; } return err;