Re: [PATCH] libmount: Fix regression when mounting with atime

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

 



On Thu, Aug 17, 2023 at 10:20:13AM +0100, fdmanana@xxxxxxxxxx wrote:
> A regression was introduced in v2.39 that causes mounting with the atime
> option to fail:
> 
>   $ mkfs.ext4 -F /dev/sdi
>   $ mount -o atime /dev/sdi /mnt/sdi
>   mount: /mnt/sdi: not mount point or bad option.
>          dmesg(1) may have more information after failed mount system call.
 
Great timing! I just released bugfix tarball v2.39.2 a few minutes ago :-)

> diff --git a/libmount/src/optlist.c b/libmount/src/optlist.c
> index e93810b47..d0afc94f7 100644
> --- a/libmount/src/optlist.c
> +++ b/libmount/src/optlist.c
> @@ -875,7 +875,18 @@ int mnt_optlist_get_attrs(struct libmnt_optlist *ls, uint64_t *set, uint64_t *cl
>  
>  		if (opt->ent->mask & MNT_INVERT) {
>  			DBG(OPTLIST, ul_debugobj(ls, " clr: %s", opt->ent->name));
> -			*clr |= x;
> +			/*
> +			 * All atime settings are mutually exclusive so *clr must
> +			 * have MOUNT_ATTR__ATIME set.
> +			 *
> +			 * See the function fs/namespace.c:build_mount_kattr()
> +			 * in the linux kernel source.
> +			 */
> +			if (x == MOUNT_ATTR_RELATIME || x == MOUNT_ATTR_NOATIME ||
> +			    x == MOUNT_ATTR_STRICTATIME)
> +				*clr |= MOUNT_ATTR__ATIME;
> +			else
> +				*clr |= x;

Ah, the libmount code does this, but only when set a new option. This is
missing for inverted options (like atime).

> +# Test that the atime option works after the migration to use the new kernel mount APIs.
> +ts_run $TESTPROG --mount -o atime $DEVICE $MOUNTPOINT >> $TS_OUTPUT 2>> $TS_ERRLOG
> +$TS_CMD_FINDMNT --kernel --mountpoint $MOUNTPOINT -o VFS-OPTIONS -n >> $TS_OUTPUT 2>> $TS_ERRLOG
> +is_mounted $DEVICE || echo "$DEVICE not mounted" >> $TS_OUTPUT 2>> $TS_ERRLOG
> +ts_run $TESTPROG --umount $MOUNTPOINT >> $TS_OUTPUT 2>> $TS_ERRLOG
> +is_mounted $DEVICE && echo "$DEVICE still mounted" >> $TS_OUTPUT 2>> $TS_ERRLOG
> +
> +ts_finalize_subtest

Applied, thanks, and extra thanks for the tests!

    Karel


-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux