ACK: [PATCH][SRC][XENIAL] UBUNTU: SAUCE: Allow mounting datasets more than once (LP: #1759848)
Colin Ian King
colin.king at canonical.com
Thu Jul 12 14:00:17 UTC 2018
Note. Subject should be [PATCH][SRU][XENUAL]...
On 26/06/18 14:11, Seth Forshee wrote:
> On Mon, Jun 25, 2018 at 08:36:41PM +0100, Colin King wrote:
>> From: Colin Ian King <colin.king at canonical.com>
>>
>> BugLink: https://bugs.launchpad.net/bugs/1759848
>>
>> Currently mounting an already mounted zfs dataset results in an
>> error, whereas it is typically allowed with other filesystems.
>> This causes some bad interactions with mount namespaces. Take
>> this sequence for example:
>>
>> - Create a dataset
>> - Create a snapshot of the dataset
>> - Create a clone of the snapshot
>> - Create a new mount namespace
>> - Rename the original dataset
>>
>> The rename results in unmounting and remounting the clone in the
>> original mount namespace, however the remount fails because the
>> dataset is still mounted in the new mount namespace. (Note that
>> this means the mount in the new mount namespace is never being
>> unmounted, so perhaps the unmount/remount of the clone isn't
>> actually necessary.)
>>
>> The problem here is a result of the way mounting is implemented
>> in the kernel module. Since it is not mounting block devices it
>> uses mount_nodev() instead of the usual mount_bdev(). However,
>> mount_nodev() is written for filesystems for which each mount is
>> a new instance (i.e. a new super block), and zfs should be able
>> to detect when a mount request can be satisfied using an existing
>> super block.
>>
>> Change zpl_mount() to call sget() directly with it's own test
>> callback. Passing the objset_t object as the fs data allows
>> checking if a superblock already exists for the dataset, and in
>> that case we just need to return a new reference for the sb's
>> root dentry.
>>
>> [ Sync'd from zfsutils-linux, from a patch by Seth Forshee and
>> backported to zfs 0.6.5.6. Note that this also contains
>> some zfstutils changes between 0.6.5.6-0ubuntu20 and
>> 0.6.5.6-0ubuntu24 which go also sync'd into this fix, which
>> is expected part of the zfs sync'ing ]
>>
>> Signed-off-by: Colin Ian King <colin.king at canonical.com>
>
> Backport looks good.
>
> Acked-by: Seth Forshee <seth.forshee at canonical.com>
>
More information about the kernel-team
mailing list