linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] staging: erofs: inline erofs_inode_is_data_compressed()
@ 2019-08-13  2:30 Gao Xiang
  2019-08-13  2:30 ` [PATCH 2/3] staging: erofs: remove incomplete cleancache Gao Xiang
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Gao Xiang @ 2019-08-13  2:30 UTC (permalink / raw)
  To: Chao Yu, Greg Kroah-Hartman, devel, linux-fsdevel
  Cc: LKML, linux-erofs, Chao Yu, Miao Xie, weidu.du, Fang Wei, Gao Xiang

As a helper in erofs_fs.h, erofs_inode_is_data_compressed()
should be inlined.

Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
---
 drivers/staging/erofs/erofs_fs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/erofs/erofs_fs.h b/drivers/staging/erofs/erofs_fs.h
index e82e833985e4..8dc2a75e478f 100644
--- a/drivers/staging/erofs/erofs_fs.h
+++ b/drivers/staging/erofs/erofs_fs.h
@@ -62,7 +62,7 @@ enum {
 	EROFS_INODE_LAYOUT_MAX
 };
 
-static bool erofs_inode_is_data_compressed(unsigned int datamode)
+static inline bool erofs_inode_is_data_compressed(unsigned int datamode)
 {
 	if (datamode == EROFS_INODE_FLAT_COMPRESSION)
 		return true;
-- 
2.17.1


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

* [PATCH 2/3] staging: erofs: remove incomplete cleancache
  2019-08-13  2:30 [PATCH 1/3] staging: erofs: inline erofs_inode_is_data_compressed() Gao Xiang
@ 2019-08-13  2:30 ` Gao Xiang
  2019-08-13  3:09   ` Chao Yu
  2019-08-13  2:30 ` [PATCH 3/3] staging: erofs: xattr.c: avoid BUG_ON Gao Xiang
  2019-08-13  3:08 ` [PATCH 1/3] staging: erofs: inline erofs_inode_is_data_compressed() Chao Yu
  2 siblings, 1 reply; 8+ messages in thread
From: Gao Xiang @ 2019-08-13  2:30 UTC (permalink / raw)
  To: Chao Yu, Greg Kroah-Hartman, devel, linux-fsdevel
  Cc: LKML, linux-erofs, Chao Yu, Miao Xie, weidu.du, Fang Wei, Gao Xiang

cleancache was not fully implemented in EROFS.
In addition, it's tend to remove the whole cleancache in
related attempt [1].

[1] https://lore.kernel.org/linux-fsdevel/20190527103207.13287-3-jgross@suse.com/
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
---
 drivers/staging/erofs/data.c     | 6 ------
 drivers/staging/erofs/internal.h | 1 -
 2 files changed, 7 deletions(-)

diff --git a/drivers/staging/erofs/data.c b/drivers/staging/erofs/data.c
index 75b859e48084..4cdb743c8b8d 100644
--- a/drivers/staging/erofs/data.c
+++ b/drivers/staging/erofs/data.c
@@ -201,12 +201,6 @@ static inline struct bio *erofs_read_raw_page(struct bio *bio,
 		goto has_updated;
 	}
 
-	if (cleancache_get_page(page) == 0) {
-		err = 0;
-		SetPageUptodate(page);
-		goto has_updated;
-	}
-
 	/* note that for readpage case, bio also equals to NULL */
 	if (bio &&
 	    /* not continuous */
diff --git a/drivers/staging/erofs/internal.h b/drivers/staging/erofs/internal.h
index 118e7c7e4d4d..4ce5991c381f 100644
--- a/drivers/staging/erofs/internal.h
+++ b/drivers/staging/erofs/internal.h
@@ -15,7 +15,6 @@
 #include <linux/pagemap.h>
 #include <linux/bio.h>
 #include <linux/buffer_head.h>
-#include <linux/cleancache.h>
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
 #include "erofs_fs.h"
-- 
2.17.1


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

* [PATCH 3/3] staging: erofs: xattr.c: avoid BUG_ON
  2019-08-13  2:30 [PATCH 1/3] staging: erofs: inline erofs_inode_is_data_compressed() Gao Xiang
  2019-08-13  2:30 ` [PATCH 2/3] staging: erofs: remove incomplete cleancache Gao Xiang
@ 2019-08-13  2:30 ` Gao Xiang
  2019-08-13  3:20   ` Chao Yu
  2019-08-13  3:08 ` [PATCH 1/3] staging: erofs: inline erofs_inode_is_data_compressed() Chao Yu
  2 siblings, 1 reply; 8+ messages in thread
From: Gao Xiang @ 2019-08-13  2:30 UTC (permalink / raw)
  To: Chao Yu, Greg Kroah-Hartman, devel, linux-fsdevel
  Cc: LKML, linux-erofs, Chao Yu, Miao Xie, weidu.du, Fang Wei, Gao Xiang

Kill all the remaining BUG_ON in EROFS:
 - one BUG_ON was used to detect xattr on-disk corruption,
   proper error handling should be added for it instead;
 - the other BUG_ONs are used to detect potential issues,
   use DBG_BUGON only in (eng) debugging version.

Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
---
 drivers/staging/erofs/xattr.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/erofs/xattr.c b/drivers/staging/erofs/xattr.c
index b29177a17347..289c7850ec96 100644
--- a/drivers/staging/erofs/xattr.c
+++ b/drivers/staging/erofs/xattr.c
@@ -115,7 +115,7 @@ static int init_inode_xattrs(struct inode *inode)
 	for (i = 0; i < vi->xattr_shared_count; ++i) {
 		if (unlikely(it.ofs >= EROFS_BLKSIZ)) {
 			/* cannot be unaligned */
-			BUG_ON(it.ofs != EROFS_BLKSIZ);
+			DBG_BUGON(it.ofs != EROFS_BLKSIZ);
 			xattr_iter_end(&it, atomic_map);
 
 			it.page = erofs_get_meta_page(sb, ++it.blkaddr,
@@ -191,7 +191,7 @@ static int inline_xattr_iter_begin(struct xattr_iter *it,
 
 	xattr_header_sz = inlinexattr_header_size(inode);
 	if (unlikely(xattr_header_sz >= vi->xattr_isize)) {
-		BUG_ON(xattr_header_sz > vi->xattr_isize);
+		DBG_BUGON(xattr_header_sz > vi->xattr_isize);
 		return -ENOATTR;
 	}
 
@@ -234,7 +234,11 @@ static int xattr_foreach(struct xattr_iter *it,
 	if (tlimit) {
 		unsigned int entry_sz = EROFS_XATTR_ENTRY_SIZE(&entry);
 
-		BUG_ON(*tlimit < entry_sz);
+		/* xattr on-disk corruption: xattr entry beyond xattr_isize */
+		if (unlikely(*tlimit < entry_sz)) {
+			DBG_BUGON(1);
+			return -EIO;
+		}
 		*tlimit -= entry_sz;
 	}
 
@@ -253,7 +257,7 @@ static int xattr_foreach(struct xattr_iter *it,
 
 	while (processed < entry.e_name_len) {
 		if (it->ofs >= EROFS_BLKSIZ) {
-			BUG_ON(it->ofs > EROFS_BLKSIZ);
+			DBG_BUGON(it->ofs > EROFS_BLKSIZ);
 
 			err = xattr_iter_fixup(it);
 			if (err)
@@ -288,7 +292,7 @@ static int xattr_foreach(struct xattr_iter *it,
 
 	while (processed < value_sz) {
 		if (it->ofs >= EROFS_BLKSIZ) {
-			BUG_ON(it->ofs > EROFS_BLKSIZ);
+			DBG_BUGON(it->ofs > EROFS_BLKSIZ);
 
 			err = xattr_iter_fixup(it);
 			if (err)
-- 
2.17.1


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

* Re: [PATCH 1/3] staging: erofs: inline erofs_inode_is_data_compressed()
  2019-08-13  2:30 [PATCH 1/3] staging: erofs: inline erofs_inode_is_data_compressed() Gao Xiang
  2019-08-13  2:30 ` [PATCH 2/3] staging: erofs: remove incomplete cleancache Gao Xiang
  2019-08-13  2:30 ` [PATCH 3/3] staging: erofs: xattr.c: avoid BUG_ON Gao Xiang
@ 2019-08-13  3:08 ` Chao Yu
  2 siblings, 0 replies; 8+ messages in thread
From: Chao Yu @ 2019-08-13  3:08 UTC (permalink / raw)
  To: Gao Xiang, Greg Kroah-Hartman, devel, linux-fsdevel
  Cc: LKML, linux-erofs, Chao Yu, Miao Xie, weidu.du, Fang Wei

On 2019/8/13 10:30, Gao Xiang wrote:
> As a helper in erofs_fs.h, erofs_inode_is_data_compressed()
> should be inlined.
> 
> Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,

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

* Re: [PATCH 2/3] staging: erofs: remove incomplete cleancache
  2019-08-13  2:30 ` [PATCH 2/3] staging: erofs: remove incomplete cleancache Gao Xiang
@ 2019-08-13  3:09   ` Chao Yu
  0 siblings, 0 replies; 8+ messages in thread
From: Chao Yu @ 2019-08-13  3:09 UTC (permalink / raw)
  To: Gao Xiang, Greg Kroah-Hartman, devel, linux-fsdevel
  Cc: LKML, linux-erofs, Chao Yu, Miao Xie, weidu.du, Fang Wei

On 2019/8/13 10:30, Gao Xiang wrote:
> cleancache was not fully implemented in EROFS.
> In addition, it's tend to remove the whole cleancache in
> related attempt [1].
> 
> [1] https://lore.kernel.org/linux-fsdevel/20190527103207.13287-3-jgross@suse.com/
> Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,

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

* Re: [PATCH 3/3] staging: erofs: xattr.c: avoid BUG_ON
  2019-08-13  2:30 ` [PATCH 3/3] staging: erofs: xattr.c: avoid BUG_ON Gao Xiang
@ 2019-08-13  3:20   ` Chao Yu
  2019-08-13  3:57     ` Gao Xiang
  0 siblings, 1 reply; 8+ messages in thread
From: Chao Yu @ 2019-08-13  3:20 UTC (permalink / raw)
  To: Gao Xiang, Greg Kroah-Hartman, devel, linux-fsdevel
  Cc: LKML, linux-erofs, Chao Yu, Miao Xie, weidu.du, Fang Wei

On 2019/8/13 10:30, Gao Xiang wrote:
> Kill all the remaining BUG_ON in EROFS:
>  - one BUG_ON was used to detect xattr on-disk corruption,
>    proper error handling should be added for it instead;
>  - the other BUG_ONs are used to detect potential issues,
>    use DBG_BUGON only in (eng) debugging version.

BTW, do we need add WARN_ON() into DBG_BUGON() to show some details function or
call stack in where we encounter the issue?

> 
> Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,

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

* Re: [PATCH 3/3] staging: erofs: xattr.c: avoid BUG_ON
  2019-08-13  3:20   ` Chao Yu
@ 2019-08-13  3:57     ` Gao Xiang
  2019-08-13  6:10       ` Chao Yu
  0 siblings, 1 reply; 8+ messages in thread
From: Gao Xiang @ 2019-08-13  3:57 UTC (permalink / raw)
  To: Chao Yu
  Cc: Greg Kroah-Hartman, devel, linux-fsdevel, LKML, linux-erofs,
	Chao Yu, Miao Xie, weidu.du, Fang Wei

Hi Chao,

On Tue, Aug 13, 2019 at 11:20:22AM +0800, Chao Yu wrote:
> On 2019/8/13 10:30, Gao Xiang wrote:
> > Kill all the remaining BUG_ON in EROFS:
> >  - one BUG_ON was used to detect xattr on-disk corruption,
> >    proper error handling should be added for it instead;
> >  - the other BUG_ONs are used to detect potential issues,
> >    use DBG_BUGON only in (eng) debugging version.
> 
> BTW, do we need add WARN_ON() into DBG_BUGON() to show some details function or
> call stack in where we encounter the issue?

Thanks for kindly review :)

Agreed, it seems much better. If there are no other considerations
here, I can submit another patch addressing it later or maybe we
can change it in the next linux version since I'd like to focusing
on moving out of staging for this round...

Thanks,
Gao Xiang

> 
> > 
> > Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
> 
> Reviewed-by: Chao Yu <yuchao0@huawei.com>
> 
> Thanks,

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

* Re: [PATCH 3/3] staging: erofs: xattr.c: avoid BUG_ON
  2019-08-13  3:57     ` Gao Xiang
@ 2019-08-13  6:10       ` Chao Yu
  0 siblings, 0 replies; 8+ messages in thread
From: Chao Yu @ 2019-08-13  6:10 UTC (permalink / raw)
  To: Gao Xiang
  Cc: Greg Kroah-Hartman, devel, linux-fsdevel, LKML, linux-erofs,
	Chao Yu, Miao Xie, weidu.du, Fang Wei

Hi Xiang,

On 2019/8/13 11:57, Gao Xiang wrote:
> Hi Chao,
> 
> On Tue, Aug 13, 2019 at 11:20:22AM +0800, Chao Yu wrote:
>> On 2019/8/13 10:30, Gao Xiang wrote:
>>> Kill all the remaining BUG_ON in EROFS:
>>>  - one BUG_ON was used to detect xattr on-disk corruption,
>>>    proper error handling should be added for it instead;
>>>  - the other BUG_ONs are used to detect potential issues,
>>>    use DBG_BUGON only in (eng) debugging version.
>>
>> BTW, do we need add WARN_ON() into DBG_BUGON() to show some details function or
>> call stack in where we encounter the issue?
> 
> Thanks for kindly review :)
> 
> Agreed, it seems much better. If there are no other considerations
> here, I can submit another patch addressing it later or maybe we
> can change it in the next linux version since I'd like to focusing
> on moving out of staging for this round...

No problem, we can change it in a proper time.

Thanks,

> 
> Thanks,
> Gao Xiang
> 
>>
>>>
>>> Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
>>
>> Reviewed-by: Chao Yu <yuchao0@huawei.com>
>>
>> Thanks,
> .
> 

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

end of thread, other threads:[~2019-08-13  6:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-13  2:30 [PATCH 1/3] staging: erofs: inline erofs_inode_is_data_compressed() Gao Xiang
2019-08-13  2:30 ` [PATCH 2/3] staging: erofs: remove incomplete cleancache Gao Xiang
2019-08-13  3:09   ` Chao Yu
2019-08-13  2:30 ` [PATCH 3/3] staging: erofs: xattr.c: avoid BUG_ON Gao Xiang
2019-08-13  3:20   ` Chao Yu
2019-08-13  3:57     ` Gao Xiang
2019-08-13  6:10       ` Chao Yu
2019-08-13  3:08 ` [PATCH 1/3] staging: erofs: inline erofs_inode_is_data_compressed() Chao Yu

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