linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Btrfs: do not mount when we have a sectorsize larger than PAGE_SIZE
@ 2012-04-02 11:28 Liu Bo
  2012-04-02 12:17 ` David Sterba
  0 siblings, 1 reply; 4+ messages in thread
From: Liu Bo @ 2012-04-02 11:28 UTC (permalink / raw)
  To: linux-btrfs

Our code is not ready to cope with a sectorsize that's larger than PAGE_SIZE.

Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
---
 fs/btrfs/disk-io.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 20196f4..08e49d2 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2104,6 +2104,14 @@ int open_ctree(struct super_block *sb,
 		err = -EINVAL;
 		goto fail_alloc;
 	}
+	if (btrfs_super_sectorsize(disk_super) > PAGE_CACHE_SIZE) {
+		printk(KERN_ERR "BTRFS: couldn't mount because sectorsize(%d)"
+		       " was larger than PAGE_SIZE(%lu)\n",
+		       btrfs_super_sectorsize(disk_super),
+		       (unsigned long long)PAGE_CACHE_SIZE);
+		err = -EINVAL;
+		goto fail_alloc;
+	}
 
 	features = btrfs_super_incompat_flags(disk_super);
 	features |= BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF;
-- 
1.6.5.2


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

* Re: [PATCH] Btrfs: do not mount when we have a sectorsize larger than PAGE_SIZE
  2012-04-02 11:28 [PATCH] Btrfs: do not mount when we have a sectorsize larger than PAGE_SIZE Liu Bo
@ 2012-04-02 12:17 ` David Sterba
  2012-04-03  1:15   ` Liu Bo
  0 siblings, 1 reply; 4+ messages in thread
From: David Sterba @ 2012-04-02 12:17 UTC (permalink / raw)
  To: Liu Bo; +Cc: linux-btrfs

On Mon, Apr 02, 2012 at 07:28:18PM +0800, Liu Bo wrote:
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -2104,6 +2104,14 @@ int open_ctree(struct super_block *sb,
>  		err = -EINVAL;
>  		goto fail_alloc;
>  	}
> +	if (btrfs_super_sectorsize(disk_super) > PAGE_CACHE_SIZE) {
> +		printk(KERN_ERR "BTRFS: couldn't mount because sectorsize(%d)"
> +		       " was larger than PAGE_SIZE(%lu)\n",

%llu

> +		       btrfs_super_sectorsize(disk_super),
> +		       (unsigned long long)PAGE_CACHE_SIZE);
> +		err = -EINVAL;
> +		goto fail_alloc;
> +	}
>  
>  	features = btrfs_super_incompat_flags(disk_super);
>  	features |= BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF;

We have the opposite check a few lines below

2257         if (sectorsize < PAGE_SIZE) {
2258                 printk(KERN_WARNING "btrfs: Incompatible sector size "
2259                        "found on %s\n", sb->s_id);
2260                 goto fail_sb_buffer;
2261         }
2262

so sectorsize must be equal to PAGE_SIZE always and one check can catch
both cases.


david

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

* Re: [PATCH] Btrfs: do not mount when we have a sectorsize larger than PAGE_SIZE
  2012-04-02 12:17 ` David Sterba
@ 2012-04-03  1:15   ` Liu Bo
  2012-04-04  9:17     ` James Courtier-Dutton
  0 siblings, 1 reply; 4+ messages in thread
From: Liu Bo @ 2012-04-03  1:15 UTC (permalink / raw)
  To: linux-btrfs

On 04/02/2012 08:17 PM, David Sterba wrote:
> On Mon, Apr 02, 2012 at 07:28:18PM +0800, Liu Bo wrote:
>> --- a/fs/btrfs/disk-io.c
>> +++ b/fs/btrfs/disk-io.c
>> @@ -2104,6 +2104,14 @@ int open_ctree(struct super_block *sb,
>>  		err = -EINVAL;
>>  		goto fail_alloc;
>>  	}
>> +	if (btrfs_super_sectorsize(disk_super) > PAGE_CACHE_SIZE) {
>> +		printk(KERN_ERR "BTRFS: couldn't mount because sectorsize(%d)"
>> +		       " was larger than PAGE_SIZE(%lu)\n",
> 
> %llu
> 

err, thanks for caching it.

>> +		       btrfs_super_sectorsize(disk_super),
>> +		       (unsigned long long)PAGE_CACHE_SIZE);
>> +		err = -EINVAL;
>> +		goto fail_alloc;
>> +	}
>>  
>>  	features = btrfs_super_incompat_flags(disk_super);
>>  	features |= BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF;
> 
> We have the opposite check a few lines below
> 
> 2257         if (sectorsize < PAGE_SIZE) {
> 2258                 printk(KERN_WARNING "btrfs: Incompatible sector size "
> 2259                        "found on %s\n", sb->s_id);
> 2260                 goto fail_sb_buffer;
> 2261         }
> 2262
> 
> so sectorsize must be equal to PAGE_SIZE always and one check can catch
> both cases.
> 

But this check is _useless_ when we have a sectorsize which is larger than PAGE_SIZE,
we're not ready for that, too.

We already have one check, so I'll modify this instead. :)

thanks,
liubo

> 
> david
> --
> 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] 4+ messages in thread

* Re: [PATCH] Btrfs: do not mount when we have a sectorsize larger than PAGE_SIZE
  2012-04-03  1:15   ` Liu Bo
@ 2012-04-04  9:17     ` James Courtier-Dutton
  0 siblings, 0 replies; 4+ messages in thread
From: James Courtier-Dutton @ 2012-04-04  9:17 UTC (permalink / raw)
  To: Liu Bo; +Cc: linux-btrfs

On 3 April 2012 02:15, Liu Bo <liubo2009@cn.fujitsu.com> wrote:
> On 04/02/2012 08:17 PM, David Sterba wrote:
>> On Mon, Apr 02, 2012 at 07:28:18PM +0800, Liu Bo wrote:
>>> --- a/fs/btrfs/disk-io.c
>>> +++ b/fs/btrfs/disk-io.c
>>> @@ -2104,6 +2104,14 @@ int open_ctree(struct super_block *sb,
>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0err =3D -EINVAL;
>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0goto fail_alloc;
>>> =C2=A0 =C2=A0 =C2=A0}
>>> + =C2=A0 =C2=A0if (btrfs_super_sectorsize(disk_super) > PAGE_CACHE_=
SIZE) {
>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0printk(KERN_ERR "BTRFS: =
couldn't mount because sectorsize(%d)"
>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 " =
was larger than PAGE_SIZE(%lu)\n",
>>
>> %llu
>>
>
> err, thanks for caching it.
>
>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 bt=
rfs_super_sectorsize(disk_super),
>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (u=
nsigned long long)PAGE_CACHE_SIZE);
>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0err =3D -EINVAL;
>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0goto fail_alloc;
>>> + =C2=A0 =C2=A0}
>>>
>>> =C2=A0 =C2=A0 =C2=A0features =3D btrfs_super_incompat_flags(disk_su=
per);
>>> =C2=A0 =C2=A0 =C2=A0features |=3D BTRFS_FEATURE_INCOMPAT_MIXED_BACK=
REF;
>>
>> We have the opposite check a few lines below
>>
>> 2257 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (sectorsize < PAGE_SIZE) {
>> 2258 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 printk(=
KERN_WARNING "btrfs: Incompatible sector size "
>> 2259 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0"found on %s\n", sb->s_id);
>> 2260 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 goto fa=
il_sb_buffer;
>> 2261 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
>> 2262
>>
>> so sectorsize must be equal to PAGE_SIZE always and one check can ca=
tch
>> both cases.
>>
>
> But this check is _useless_ when we have a sectorsize which is larger=
 than PAGE_SIZE,
> we're not ready for that, too.
>
> We already have one check, so I'll modify this instead. :)
>

Minor observation.
One is "PAGE_SIZE" and one is "PAGE_CACHE_SIZE".
Might those be different?
--
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] 4+ messages in thread

end of thread, other threads:[~2012-04-04  9:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-02 11:28 [PATCH] Btrfs: do not mount when we have a sectorsize larger than PAGE_SIZE Liu Bo
2012-04-02 12:17 ` David Sterba
2012-04-03  1:15   ` Liu Bo
2012-04-04  9:17     ` James Courtier-Dutton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).