linux-erofs.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] erofs: fix misbehavior of unsupported chunk format check
@ 2021-09-22  9:51 Gao Xiang
  2021-09-22 17:48 ` Liu Bo
  2021-09-23 15:09 ` Chao Yu
  0 siblings, 2 replies; 4+ messages in thread
From: Gao Xiang @ 2021-09-22  9:51 UTC (permalink / raw)
  To: linux-erofs, Chao Yu, Liu Bo; +Cc: Gao Xiang, LKML

Unsupported chunk format should be checked with
"if (vi->chunkformat & ~EROFS_CHUNK_FORMAT_ALL)"

Found when checking with 4k-byte blockmap (although currently mkfs
uses inode chunk indexes format by default.)

Fixes: c5aa903a59db ("erofs: support reading chunk-based uncompressed files")
Cc: Liu Bo <bo.liu@linux.alibaba.com>
Cc: Chao Yu <chao@kernel.org>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
---
 fs/erofs/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c
index 31ac3a7..a552399 100644
--- a/fs/erofs/inode.c
+++ b/fs/erofs/inode.c
@@ -176,7 +176,7 @@ static struct page *erofs_read_inode(struct inode *inode,
 	}
 
 	if (vi->datalayout == EROFS_INODE_CHUNK_BASED) {
-		if (!(vi->chunkformat & EROFS_CHUNK_FORMAT_ALL)) {
+		if (vi->chunkformat & ~EROFS_CHUNK_FORMAT_ALL) {
 			erofs_err(inode->i_sb,
 				  "unsupported chunk format %x of nid %llu",
 				  vi->chunkformat, vi->nid);
-- 
1.8.3.1


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

* Re: [PATCH] erofs: fix misbehavior of unsupported chunk format check
  2021-09-22  9:51 [PATCH] erofs: fix misbehavior of unsupported chunk format check Gao Xiang
@ 2021-09-22 17:48 ` Liu Bo
  2021-09-23 15:09 ` Chao Yu
  1 sibling, 0 replies; 4+ messages in thread
From: Liu Bo @ 2021-09-22 17:48 UTC (permalink / raw)
  To: Gao Xiang; +Cc: linux-erofs, LKML

On Wed, Sep 22, 2021 at 05:51:41PM +0800, Gao Xiang wrote:
> Unsupported chunk format should be checked with
> "if (vi->chunkformat & ~EROFS_CHUNK_FORMAT_ALL)"
> 
> Found when checking with 4k-byte blockmap (although currently mkfs
> uses inode chunk indexes format by default.)
>

Good catch.

Reviewed-by: Liu Bo <bo.liu@linux.alibaba.com>

thanks,
liubo

> Fixes: c5aa903a59db ("erofs: support reading chunk-based uncompressed files")
> Cc: Liu Bo <bo.liu@linux.alibaba.com>
> Cc: Chao Yu <chao@kernel.org>
> Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
> ---
>  fs/erofs/inode.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c
> index 31ac3a7..a552399 100644
> --- a/fs/erofs/inode.c
> +++ b/fs/erofs/inode.c
> @@ -176,7 +176,7 @@ static struct page *erofs_read_inode(struct inode *inode,
>  	}
>  
>  	if (vi->datalayout == EROFS_INODE_CHUNK_BASED) {
> -		if (!(vi->chunkformat & EROFS_CHUNK_FORMAT_ALL)) {
> +		if (vi->chunkformat & ~EROFS_CHUNK_FORMAT_ALL) {
>  			erofs_err(inode->i_sb,
>  				  "unsupported chunk format %x of nid %llu",
>  				  vi->chunkformat, vi->nid);
> -- 
> 1.8.3.1

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

* Re: [PATCH] erofs: fix misbehavior of unsupported chunk format check
  2021-09-22  9:51 [PATCH] erofs: fix misbehavior of unsupported chunk format check Gao Xiang
  2021-09-22 17:48 ` Liu Bo
@ 2021-09-23 15:09 ` Chao Yu
  2021-09-23 15:19   ` Gao Xiang
  1 sibling, 1 reply; 4+ messages in thread
From: Chao Yu @ 2021-09-23 15:09 UTC (permalink / raw)
  To: Gao Xiang, linux-erofs, Liu Bo; +Cc: LKML

On 2021/9/22 17:51, Gao Xiang wrote:
> Unsupported chunk format should be checked with
> "if (vi->chunkformat & ~EROFS_CHUNK_FORMAT_ALL)"
> 
> Found when checking with 4k-byte blockmap (although currently mkfs

That means for 4k-byte blockmap, chunkformat should be zero, right?

> uses inode chunk indexes format by default.)
> 
> Fixes: c5aa903a59db ("erofs: support reading chunk-based uncompressed files")
> Cc: Liu Bo <bo.liu@linux.alibaba.com>
> Cc: Chao Yu <chao@kernel.org>
> Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,

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

* Re: [PATCH] erofs: fix misbehavior of unsupported chunk format check
  2021-09-23 15:09 ` Chao Yu
@ 2021-09-23 15:19   ` Gao Xiang
  0 siblings, 0 replies; 4+ messages in thread
From: Gao Xiang @ 2021-09-23 15:19 UTC (permalink / raw)
  To: Chao Yu; +Cc: Gao Xiang, linux-erofs, LKML, Liu Bo

On Thu, Sep 23, 2021 at 11:09:25PM +0800, Chao Yu wrote:
> On 2021/9/22 17:51, Gao Xiang wrote:
> > Unsupported chunk format should be checked with
> > "if (vi->chunkformat & ~EROFS_CHUNK_FORMAT_ALL)"
> > 
> > Found when checking with 4k-byte blockmap (although currently mkfs
> 
> That means for 4k-byte blockmap, chunkformat should be zero, right?

Yeah, correct. It's a regression of 4kb chunk blockmap..

> 
> > uses inode chunk indexes format by default.)
> > 
> > Fixes: c5aa903a59db ("erofs: support reading chunk-based uncompressed files")
> > Cc: Liu Bo <bo.liu@linux.alibaba.com>
> > Cc: Chao Yu <chao@kernel.org>
> > Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
> 
> Reviewed-by: Chao Yu <chao@kernel.org>

Thanks!

Thanks,
Gao Xiang

> 
> Thanks,

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

end of thread, other threads:[~2021-09-23 15:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-22  9:51 [PATCH] erofs: fix misbehavior of unsupported chunk format check Gao Xiang
2021-09-22 17:48 ` Liu Bo
2021-09-23 15:09 ` Chao Yu
2021-09-23 15:19   ` Gao Xiang

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).