Skip to contentSkip to conversation

f2fs: return error number for quota_write

PATCH In review Jaegeuk Kim 3 participants 8 messages Oct 12, 2017 – Oct 22, 2017

Subsystems (2)
lore
Share & tools
lore

Jaegeuk Kim

author maintainer
#0 lore raw

PATCH 1/1 f2fs: return error number for quota_write

This patch returns an error number to quota_write in order for quota to handle it correctly.

---
 fs/f2fs/super.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
fs/f2fs/super.c +4 -1
index 2feecf5e7f4c..840a0876005b 100644
@@ -1397,8 +1397,11 @@ static ssize_t f2fs_quota_write(struct super_block *sb, int type,
 
 		err = a_ops->write_begin(NULL, mapping, off, tocopy, 0,
 							&page, NULL);
-		if (unlikely(err))
+		if (unlikely(err)) {
+			if (len == towrite)
+				return err;
 			break;
+		}
 
 		kaddr = kmap_atomic(page);
 		memcpy(kaddr + offset, data, tocopy);
Signature · 1 line
2.14.0.rc1.383.gd1ce394fe2-goog
#1 lore raw

Hi Jaegeuk,

Quoted 2 lines · Jaegeuk Kim

This patch returns an error number to quota_write in order for quota to handle it correctly.

We should return error number like __generic_file_write_iter, right? it needs to return written bytes if we have written one page or more, otherwise return error number feedbacked from write_begin.

So how about reverting 4f31d26b0c17 ("f2fs: return wrong error number on f2fs_quota_write")?

Thanks,

Quoted 24 lines
---
 fs/f2fs/super.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
fs/f2fs/super.c +4 -1
index 2feecf5e7f4c..840a0876005b 100644
@@ -1397,8 +1397,11 @@ static ssize_t f2fs_quota_write(struct super_block *sb, int type,
 
 		err = a_ops->write_begin(NULL, mapping, off, tocopy, 0,
 							&page, NULL);
-		if (unlikely(err))
+		if (unlikely(err)) {
+			if (len == towrite)
+				return err;
 			break;
+		}
 
 		kaddr = kmap_atomic(page);
 		memcpy(kaddr + offset, data, tocopy);
author maintainer
#2 lore raw
Quoted 6 lines · Chao Yu

Hi Jaegeuk,

Quoted 2 lines · Jaegeuk Kim

This patch returns an error number to quota_write in order for quota to handle it correctly.

Quoted 6 lines

We should return error number like __generic_file_write_iter, right? it needs to return written bytes if we have written one page or more, otherwise return error number feedbacked from write_begin.

So how about reverting 4f31d26b0c17 ("f2fs: return wrong error number on f2fs_quota_write")?

I thought like that, but realized the code change is somewhat different between them.

Thanks,

Quoted 27 lines

Thanks,

Quoted 24 lines
---
 fs/f2fs/super.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
fs/f2fs/super.c +4 -1
index 2feecf5e7f4c..840a0876005b 100644
@@ -1397,8 +1397,11 @@ static ssize_t f2fs_quota_write(struct super_block *sb, int type,
 
 		err = a_ops->write_begin(NULL, mapping, off, tocopy, 0,
 							&page, NULL);
-		if (unlikely(err))
+		if (unlikely(err)) {
+			if (len == towrite)
+				return err;
 			break;
+		}
 
 		kaddr = kmap_atomic(page);
 		memcpy(kaddr + offset, data, tocopy);
maintainer
#3 lore raw
Quoted 11 lines · Jaegeuk Kim
Quoted 10 lines · Chao Yu

Hi Jaegeuk,

Quoted 2 lines · Jaegeuk Kim

This patch returns an error number to quota_write in order for quota to handle it correctly.

We should return error number like __generic_file_write_iter, right? it needs to return written bytes if we have written one page or more, otherwise return error number feedbacked from write_begin.

Quoted 5 lines
Quoted 2 lines

So how about reverting 4f31d26b0c17 ("f2fs: return wrong error number on f2fs_quota_write")?

I thought like that, but realized the code change is somewhat different between them.

Hmm... main structure of codes here is copied from other file systems, is there the same problem in *_quota_write of other file systems?

BTW, it looks making below judgment condition being useless.

	if (len == towrite)
		return 0;

Thanks,

Quoted 39 lines

Thanks,

Quoted 24 lines

Thanks,

Quoted 21 lines
---
 fs/f2fs/super.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
fs/f2fs/super.c +4 -1
index 2feecf5e7f4c..840a0876005b 100644
@@ -1397,8 +1397,11 @@ static ssize_t f2fs_quota_write(struct super_block *sb, int type,
 
 		err = a_ops->write_begin(NULL, mapping, off, tocopy, 0,
 							&page, NULL);
-		if (unlikely(err))
+		if (unlikely(err)) {
+			if (len == towrite)
+				return err;
 			break;
+		}
 
Quoted 3 lines

fs/f2fs/super.c static ssize_t f2fs_quota_write(struct super_block *sb, int type, · line 1407

Quoted 3 lines
fs/f2fs/super.c +0 -0
 		kaddr = kmap_atomic(page);
 		memcpy(kaddr + offset, data, tocopy);

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linux-f2fs-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

author maintainer
#4 lore raw
Quoted 20 lines · Chao Yu
Quoted 11 lines · Jaegeuk Kim
Quoted 10 lines · Chao Yu

Hi Jaegeuk,

Quoted 2 lines · Jaegeuk Kim

This patch returns an error number to quota_write in order for quota to handle it correctly.

We should return error number like __generic_file_write_iter, right? it needs to return written bytes if we have written one page or more, otherwise return error number feedbacked from write_begin.

Quoted 5 lines
Quoted 2 lines

So how about reverting 4f31d26b0c17 ("f2fs: return wrong error number on f2fs_quota_write")?

I thought like that, but realized the code change is somewhat different between them.

Quoted 7 lines

Hmm... main structure of codes here is copied from other file systems, is there the same problem in *_quota_write of other file systems?

BTW, it looks making below judgment condition being useless.

	if (len == towrite)
		return 0;

We need this to avoid needless inode updates. :P

Thanks,

Quoted 42 lines

Thanks,

Quoted 39 lines

Thanks,

Quoted 24 lines

Thanks,

Quoted 21 lines
---
 fs/f2fs/super.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
fs/f2fs/super.c +4 -1
index 2feecf5e7f4c..840a0876005b 100644
@@ -1397,8 +1397,11 @@ static ssize_t f2fs_quota_write(struct super_block *sb, int type,
 
 		err = a_ops->write_begin(NULL, mapping, off, tocopy, 0,
 							&page, NULL);
-		if (unlikely(err))
+		if (unlikely(err)) {
+			if (len == towrite)
+				return err;
 			break;
+		}
 
Quoted 3 lines

fs/f2fs/super.c static ssize_t f2fs_quota_write(struct super_block *sb, int type, · line 1407

Quoted 3 lines
fs/f2fs/super.c +0 -0
 		kaddr = kmap_atomic(page);
 		memcpy(kaddr + offset, data, tocopy);

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linux-f2fs-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

#5 lore raw
Quoted 24 lines · Jaegeuk Kim
Quoted 23 lines · Chao Yu
Quoted 11 lines · Jaegeuk Kim
Quoted 10 lines · Chao Yu

Hi Jaegeuk,

Quoted 2 lines · Jaegeuk Kim

This patch returns an error number to quota_write in order for quota to handle it correctly.

We should return error number like __generic_file_write_iter, right? it needs to return written bytes if we have written one page or more, otherwise return error number feedbacked from write_begin.

Quoted 5 lines
Quoted 2 lines

So how about reverting 4f31d26b0c17 ("f2fs: return wrong error number on f2fs_quota_write")?

I thought like that, but realized the code change is somewhat different between them.

Hmm... main structure of codes here is copied from other file systems, is there the same problem in *_quota_write of other file systems?

Quoted 6 lines
Quoted 4 lines

BTW, it looks making below judgment condition being useless.

	if (len == towrite)
		return 0;

We need this to avoid needless inode updates. :P

For err = 0 and len == towrite case, it more likes a bug of quota that passing 0 in @len.

:(, Oh, still didn't get that why there is difference in between reverting and this fixing. Can you please explain more about this?

Thanks,

Quoted 46 lines

Thanks,

Quoted 42 lines

Thanks,

Quoted 39 lines

Thanks,

Quoted 24 lines

Thanks,

Quoted 21 lines
---
 fs/f2fs/super.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
fs/f2fs/super.c +4 -1
index 2feecf5e7f4c..840a0876005b 100644
@@ -1397,8 +1397,11 @@ static ssize_t f2fs_quota_write(struct super_block *sb, int type,
 
 		err = a_ops->write_begin(NULL, mapping, off, tocopy, 0,
 							&page, NULL);
-		if (unlikely(err))
+		if (unlikely(err)) {
+			if (len == towrite)
+				return err;
 			break;
+		}
 
Quoted 3 lines

fs/f2fs/super.c static ssize_t f2fs_quota_write(struct super_block *sb, int type, · line 1407

Quoted 3 lines
fs/f2fs/super.c +0 -0
 		kaddr = kmap_atomic(page);
 		memcpy(kaddr + offset, data, tocopy);

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linux-f2fs-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Quoted 2 lines

.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot

author maintainer
#6 lore raw
Quoted 30 lines · Chao Yu
Quoted 29 lines · Jaegeuk Kim
Quoted 27 lines · Chao Yu
Quoted 11 lines · Jaegeuk Kim
Quoted 10 lines · Chao Yu

Hi Jaegeuk,

Quoted 2 lines · Jaegeuk Kim

This patch returns an error number to quota_write in order for quota to handle it correctly.

We should return error number like __generic_file_write_iter, right? it needs to return written bytes if we have written one page or more, otherwise return error number feedbacked from write_begin.

Quoted 5 lines
Quoted 2 lines

So how about reverting 4f31d26b0c17 ("f2fs: return wrong error number on f2fs_quota_write")?

I thought like that, but realized the code change is somewhat different between them.

Hmm... main structure of codes here is copied from other file systems, is there the same problem in *_quota_write of other file systems?

BTW, it looks making below judgment condition being useless.

	if (len == towrite)
		return 0;
Quoted 7 lines
Quoted 1 line

We need this to avoid needless inode updates. :P

For err = 0 and len == towrite case, it more likes a bug of quota that passing 0 in @len.

:(, Oh, still didn't get that why there is difference in between reverting and this fixing. Can you please explain more about this?

Ah, right. Let me just revert the original patch. :)

Thanks,

maintainer Reviewed-by
#7 lore raw
Quoted 33 lines · Jaegeuk Kim
Quoted 32 lines · Chao Yu
Quoted 30 lines · Jaegeuk Kim
Quoted 20 lines · Chao Yu
Quoted 11 lines · Jaegeuk Kim
Quoted 10 lines · Chao Yu

Hi Jaegeuk,

Quoted 2 lines · Jaegeuk Kim

This patch returns an error number to quota_write in order for quota to handle it correctly.

We should return error number like __generic_file_write_iter, right? it needs to return written bytes if we have written one page or more, otherwise return error number feedbacked from write_begin.

Quoted 5 lines
Quoted 2 lines

So how about reverting 4f31d26b0c17 ("f2fs: return wrong error number on f2fs_quota_write")?

I thought like that, but realized the code change is somewhat different between them.

Quoted 7 lines

Hmm... main structure of codes here is copied from other file systems, is there the same problem in *_quota_write of other file systems?

BTW, it looks making below judgment condition being useless.

	if (len == towrite)
		return 0;

We need this to avoid needless inode updates. :P

Quoted 7 lines
Quoted 5 lines

For err = 0 and len == towrite case, it more likes a bug of quota that passing 0 in @len.

:(, Oh, still didn't get that why there is difference in between reverting and this fixing. Can you please explain more about this?

Ah, right. Let me just revert the original patch. :)

Thanks,

Quoted 3 lines

Thanks,