diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 8c8d9f6d8f72..9160836664b0 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;