* [PATCH v2] file-posix: check the use_lock before setting the file lock
@ 2020-12-07 11:44 Li Feng
2020-12-07 15:32 ` Kevin Wolf
0 siblings, 1 reply; 2+ messages in thread
From: Li Feng @ 2020-12-07 11:44 UTC (permalink / raw)
To: Kevin Wolf, Max Reitz, open list:raw, open list:All patches CC here
Cc: lifeng1519, Li Feng, kyle
The scenario is that when accessing a volume on an NFS filesystem
without supporting the file lock, Qemu will complain "Failed to lock
byte 100", even when setting the file.locking = off.
We should do file lock related operations only when the file.locking is
enabled, otherwise, the syscall of 'fcnctl' will return non-zero.
Signed-off-by: Li Feng <fengli@smartx.com>
---
block/file-posix.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/file-posix.c b/block/file-posix.c
index d5fd1dbcd2..806764f7e3 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -3104,7 +3104,7 @@ static int raw_check_perm(BlockDriverState *bs, uint64_t perm, uint64_t shared,
}
/* Copy locks to the new fd */
- if (s->perm_change_fd) {
+ if (s->perm_change_fd && s->use_lock) {
ret = raw_apply_lock_bytes(NULL, s->perm_change_fd, perm, ~shared,
false, errp);
if (ret < 0) {
--
2.24.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] file-posix: check the use_lock before setting the file lock
2020-12-07 11:44 [PATCH v2] file-posix: check the use_lock before setting the file lock Li Feng
@ 2020-12-07 15:32 ` Kevin Wolf
0 siblings, 0 replies; 2+ messages in thread
From: Kevin Wolf @ 2020-12-07 15:32 UTC (permalink / raw)
To: Li Feng
Cc: lifeng1519, kyle, open list:All patches CC here, open list:raw,
Max Reitz
Am 07.12.2020 um 12:44 hat Li Feng geschrieben:
> The scenario is that when accessing a volume on an NFS filesystem
> without supporting the file lock, Qemu will complain "Failed to lock
> byte 100", even when setting the file.locking = off.
>
> We should do file lock related operations only when the file.locking is
> enabled, otherwise, the syscall of 'fcnctl' will return non-zero.
>
> Signed-off-by: Li Feng <fengli@smartx.com>
Thanks, applied to the block branch.
Kevin
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-12-07 15:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-07 11:44 [PATCH v2] file-posix: check the use_lock before setting the file lock Li Feng
2020-12-07 15:32 ` Kevin Wolf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.