[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] file-posix: check the use_lock
From: |
Kevin Wolf |
Subject: |
Re: [PATCH] file-posix: check the use_lock |
Date: |
Fri, 4 Dec 2020 11:40:16 +0100 |
Am 04.12.2020 um 11:28 hat Li Feng geschrieben:
> When setting the file.locking = false, we shouldn't set the lock.
>
> Signed-off-by: Li Feng <fengli@smartx.com>
This looks right to me, but can you add a test for this scenario to
iotest 182? This would both demonstrate the effect of the bug (I think
it would be that files are locked after reopen even with locking=off?)
and make sure that we won't have a regression later. Mentioning the
effect in the commit message would be good, too.
Kevin
> 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
>