All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: copy fsid to super_block s_uuid
@ 2017-08-01 10:35 Anand Jain
  2017-08-01 15:36 ` Darrick J. Wong
  2017-08-16 15:40 ` David Sterba
  0 siblings, 2 replies; 5+ messages in thread
From: Anand Jain @ 2017-08-01 10:35 UTC (permalink / raw)
  To: linux-btrfs; +Cc: dsterba

We didn't copy fsid to struct super_block.s_uuid so Overlay disables
index feature with btrfs as the lower FS.

kernel: overlayfs: fs on '/lower' does not support file handles, falling back to index=off.

Fix this by publishing the fsid through struct super_block.s_uuid.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
I tried to know if in case did we deliberately missed this for some reason,
however there is no information on that. If we mount a non-default subvol in
the next mount/remount, its still the same FS, so publishing the FSID
instead of subvol uuid is correct, OR I can't think any other reason for
not using s_uuid for btrfs.


 fs/btrfs/disk-io.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 080e2ebb8aa0..b7e72d040442 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2899,6 +2899,7 @@ int open_ctree(struct super_block *sb,
 
 	sb->s_blocksize = sectorsize;
 	sb->s_blocksize_bits = blksize_bits(sectorsize);
+	memcpy(&sb->s_uuid, fs_info->fsid, BTRFS_FSID_SIZE);
 
 	mutex_lock(&fs_info->chunk_mutex);
 	ret = btrfs_read_sys_array(fs_info);
-- 
2.13.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] btrfs: copy fsid to super_block s_uuid
  2017-08-01 10:35 [PATCH] btrfs: copy fsid to super_block s_uuid Anand Jain
@ 2017-08-01 15:36 ` Darrick J. Wong
  2017-08-02  6:02   ` Anand Jain
  2017-08-16 15:40 ` David Sterba
  1 sibling, 1 reply; 5+ messages in thread
From: Darrick J. Wong @ 2017-08-01 15:36 UTC (permalink / raw)
  To: Anand Jain; +Cc: linux-btrfs, dsterba

On Tue, Aug 01, 2017 at 06:35:08PM +0800, Anand Jain wrote:
> We didn't copy fsid to struct super_block.s_uuid so Overlay disables
> index feature with btrfs as the lower FS.
> 
> kernel: overlayfs: fs on '/lower' does not support file handles, falling back to index=off.
> 
> Fix this by publishing the fsid through struct super_block.s_uuid.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
> I tried to know if in case did we deliberately missed this for some reason,
> however there is no information on that. If we mount a non-default subvol in
> the next mount/remount, its still the same FS, so publishing the FSID
> instead of subvol uuid is correct, OR I can't think any other reason for
> not using s_uuid for btrfs.
> 
> 
>  fs/btrfs/disk-io.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index 080e2ebb8aa0..b7e72d040442 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -2899,6 +2899,7 @@ int open_ctree(struct super_block *sb,
>  
>  	sb->s_blocksize = sectorsize;
>  	sb->s_blocksize_bits = blksize_bits(sectorsize);
> +	memcpy(&sb->s_uuid, fs_info->fsid, BTRFS_FSID_SIZE);

uuid_copy()?

--D

>  
>  	mutex_lock(&fs_info->chunk_mutex);
>  	ret = btrfs_read_sys_array(fs_info);
> -- 
> 2.13.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] btrfs: copy fsid to super_block s_uuid
  2017-08-01 15:36 ` Darrick J. Wong
@ 2017-08-02  6:02   ` Anand Jain
  2017-08-02 17:47     ` Darrick J. Wong
  0 siblings, 1 reply; 5+ messages in thread
From: Anand Jain @ 2017-08-02  6:02 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-btrfs, dsterba


Hi Darrick,

  Thanks for commenting..

>> +	memcpy(&sb->s_uuid, fs_info->fsid, BTRFS_FSID_SIZE);
> 
> uuid_copy()?

   It requires a larger migration to use uuid_t, IMO it can be done all
   together, in a separate patch ?

   Just for experiment, starting with struct btrfs_fs_info.fsid and
   to check its foot prints, I just renamed fsid to fs_id, and compiled.
   It reports 73 'has no member named ‘fsid'' errors.
   So looks like redefining u8 fsid[] to uuid_t fsid and further updating
   all its foot prints, has to be simplified. Any suggestions ?

Thanks, Anand


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] btrfs: copy fsid to super_block s_uuid
  2017-08-02  6:02   ` Anand Jain
@ 2017-08-02 17:47     ` Darrick J. Wong
  0 siblings, 0 replies; 5+ messages in thread
From: Darrick J. Wong @ 2017-08-02 17:47 UTC (permalink / raw)
  To: Anand Jain; +Cc: linux-btrfs, dsterba

On Wed, Aug 02, 2017 at 02:02:11PM +0800, Anand Jain wrote:
> 
> Hi Darrick,
> 
>  Thanks for commenting..
> 
> >>+	memcpy(&sb->s_uuid, fs_info->fsid, BTRFS_FSID_SIZE);
> >
> >uuid_copy()?
> 
>   It requires a larger migration to use uuid_t, IMO it can be done all
>   together, in a separate patch ?
> 
>   Just for experiment, starting with struct btrfs_fs_info.fsid and
>   to check its foot prints, I just renamed fsid to fs_id, and compiled.
>   It reports 73 'has no member named ‘fsid'' errors.
>   So looks like redefining u8 fsid[] to uuid_t fsid and further updating
>   all its foot prints, has to be simplified. Any suggestions ?

Cocinelle script?

<shrug> It was a fairly simply transition for xfs and others, though
from a simple grep it looks like btrfs uses open coded u8 arrays in a
few more places.

--D

> 
> Thanks, Anand
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] btrfs: copy fsid to super_block s_uuid
  2017-08-01 10:35 [PATCH] btrfs: copy fsid to super_block s_uuid Anand Jain
  2017-08-01 15:36 ` Darrick J. Wong
@ 2017-08-16 15:40 ` David Sterba
  1 sibling, 0 replies; 5+ messages in thread
From: David Sterba @ 2017-08-16 15:40 UTC (permalink / raw)
  To: Anand Jain; +Cc: linux-btrfs, dsterba

On Tue, Aug 01, 2017 at 06:35:08PM +0800, Anand Jain wrote:
> We didn't copy fsid to struct super_block.s_uuid so Overlay disables
> index feature with btrfs as the lower FS.
> 
> kernel: overlayfs: fs on '/lower' does not support file handles, falling back to index=off.
> 
> Fix this by publishing the fsid through struct super_block.s_uuid.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
> I tried to know if in case did we deliberately missed this for some reason,
> however there is no information on that. If we mount a non-default subvol in
> the next mount/remount, its still the same FS, so publishing the FSID
> instead of subvol uuid is correct, OR I can't think any other reason for
> not using s_uuid for btrfs.

I think that setting s_uuid is the last missing bit. Overlay needs the
file handle encoding support from the lower filesystem, which is
supported. Filling the whole filesystem id is correct, the subvolume id
is encoded in the file handle buffer from inside btrfs_encode_fh.

>From that point I think the patch is ok, but haven't tested it.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-08-16 15:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-01 10:35 [PATCH] btrfs: copy fsid to super_block s_uuid Anand Jain
2017-08-01 15:36 ` Darrick J. Wong
2017-08-02  6:02   ` Anand Jain
2017-08-02 17:47     ` Darrick J. Wong
2017-08-16 15:40 ` David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.