Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Feb 2021 21:44:11 +0200
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Ka Ho Ng <khng300@gmail.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: About upgrading vnode lock in VOP
Message-ID:  <YBr9C1ODM2N9qe3s@kib.kiev.ua>
In-Reply-To: <CANnchUY6VsOW7gJRFm8MgiNZ0DV0fBHo6o=A8pdara5CHYUedg@mail.gmail.com>
References:  <CANnchUY6VsOW7gJRFm8MgiNZ0DV0fBHo6o=A8pdara5CHYUedg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Feb 03, 2021 at 10:43:10PM +0800, Ka Ho Ng wrote:
> Hi all,
> 
> Is it generally okay if an VOP upgrades the vnode lock from shared
> lock to exclusive lock in case it is held as shared lock? The reason
> behind is, the VOP would possibly extend the file size.
It is up to VOP.

As a note, you generally cannot upgrade from shared to exclusive without
dropping the lock.  This opens a possibility for the vnode to be reclaimed,
which means that VOP can no longer safely operate on the vnode.

If the scope is not just a VOP call from top of VFS, then again it might
be not safe to continue the operation.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?YBr9C1ODM2N9qe3s>