Re: [PATCH 14/52] mnt_set_expiry(): use guards

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 25, 2025 at 05:43:17AM +0100, Al Viro wrote:
> The reason why it needs only mount_locked_reader is that there's no lockless
> accesses of expiry lists.
> 
> Signed-off-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
> ---
>  fs/namespace.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/namespace.c b/fs/namespace.c
> index eabb0d996c6a..acacfe767a7c 100644
> --- a/fs/namespace.c
> +++ b/fs/namespace.c
> @@ -3858,9 +3858,8 @@ int finish_automount(struct vfsmount *m, const struct path *path)
>   */
>  void mnt_set_expiry(struct vfsmount *mnt, struct list_head *expiry_list)
>  {
> -	read_seqlock_excl(&mount_lock);
> -	list_add_tail(&real_mount(mnt)->mnt_expire, expiry_list);
> -	read_sequnlock_excl(&mount_lock);
> +	scoped_guard(mount_locked_reader)
> +		list_add_tail(&real_mount(mnt)->mnt_expire, expiry_list);

Should also just use a guard(). I don't think religiously sticking to
scoped_guard() out of conceptual aversion to guard() buys us anything.
It's cleaner to read in such short functions very clearly.




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux