Skip to contentSkip to conversation

quota: be aware of error from dquot_initialize

PATCH In review Chao Yu 2 participants 5 messages Nov 13, 2017 – Nov 17, 2017 Diskquota

lore
Share & tools
lore

Chao Yu

author
#0 lore raw

PATCH 1/1 quota: be aware of error from dquot_initialize

Commit 6184fc0b8dd7 ("quota: Propagate error from ->acquire_dquot()") missed to handle error from dquot_initialize in dquot_file_open, fix it.

---
 fs/quota/dquot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/quota/dquot.c +1 -1
index 50b0556a124f..80002c094647 100644
@@ -2133,7 +2133,7 @@ int dquot_file_open(struct inode *inode, struct file *file)
 
 	error = generic_file_open(inode, file);
 	if (!error && (file->f_mode & FMODE_WRITE))
-		dquot_initialize(inode);
+		error = dquot_initialize(inode);
 	return error;
 }
 EXPORT_SYMBOL(dquot_file_open);
Signature · 1 line
2.15.0.55.gc2ece9dc4de6
#1 lore raw
Quoted 4 lines · Chao Yu

Commit 6184fc0b8dd7 ("quota: Propagate error from ->acquire_dquot()") missed to handle error from dquot_initialize in dquot_file_open, fix it.

Good spotting. I've added the patch to my tree.

Honza

Quoted 21 lines
---
 fs/quota/dquot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/quota/dquot.c +1 -1
index 50b0556a124f..80002c094647 100644
@@ -2133,7 +2133,7 @@ int dquot_file_open(struct inode *inode, struct file *file)
 
 	error = generic_file_open(inode, file);
 	if (!error && (file->f_mode & FMODE_WRITE))
-		dquot_initialize(inode);
+		error = dquot_initialize(inode);
 	return error;
 }
 EXPORT_SYMBOL(dquot_file_open);
Signature · 1 line
2.15.0.55.gc2ece9dc4de6
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
author
#2 lore raw
Quoted 7 lines · Jan Kara
Quoted 4 lines · Chao Yu

Commit 6184fc0b8dd7 ("quota: Propagate error from ->acquire_dquot()") missed to handle error from dquot_initialize in dquot_file_open, fix it.

Good spotting. I've added the patch to my tree.

Thanks for queuing the patch. :)

BTW, I notice in add_dquot_ref we also didn't handle error of __dquot_initialize, should we handle it too?

Thanks,

Quoted 24 lines

Honza

Quoted 21 lines
---
 fs/quota/dquot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/quota/dquot.c +1 -1
index 50b0556a124f..80002c094647 100644
@@ -2133,7 +2133,7 @@ int dquot_file_open(struct inode *inode, struct file *file)
 
 	error = generic_file_open(inode, file);
 	if (!error && (file->f_mode & FMODE_WRITE))
-		dquot_initialize(inode);
+		error = dquot_initialize(inode);
 	return error;
 }
 EXPORT_SYMBOL(dquot_file_open);
Signature · 1 line
2.15.0.55.gc2ece9dc4de6
#3 lore raw
Quoted 5 lines · Chao Yu
Quoted 4 lines · Jan Kara
Quoted 3 lines · Chao Yu

Commit 6184fc0b8dd7 ("quota: Propagate error from ->acquire_dquot()") missed to handle error from dquot_initialize in dquot_file_open, fix it.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Good spotting. I've added the patch to my tree.

Thanks for queuing the patch. :)

BTW, I notice in add_dquot_ref we also didn't handle error of __dquot_initialize, should we handle it too?

It is questionable what we should do with an error in add_dquot_ref(). User asked us to turn quotas on - that succeeded just fine but then we walked over already active inodes in add_dquot_ref(), wanted to initialize accounting information, and that failed for some inode. We can just leave quota on, the accounting will work for other inodes - that's what we do now. We could also propagate the failure up and refuse to turn quotas off. I guess that's a somewhat better approach so if you want to implement that, go ahead.

Honza

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
author
#4 lore raw
Quoted 15 lines · Jan Kara
Quoted 5 lines · Chao Yu
Quoted 4 lines · Jan Kara
Quoted 3 lines · Chao Yu

Commit 6184fc0b8dd7 ("quota: Propagate error from ->acquire_dquot()") missed to handle error from dquot_initialize in dquot_file_open, fix it.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Good spotting. I've added the patch to my tree.

Thanks for queuing the patch. :)

BTW, I notice in add_dquot_ref we also didn't handle error of __dquot_initialize, should we handle it too?

Quoted 8 lines

It is questionable what we should do with an error in add_dquot_ref(). User asked us to turn quotas on - that succeeded just fine but then we walked over already active inodes in add_dquot_ref(), wanted to initialize accounting information, and that failed for some inode. We can just leave quota on, the accounting will work for other inodes - that's what we do now. We could also propagate the failure up and refuse to turn quotas off. I guess that's a somewhat better approach so if you want to implement that, go ahead.

Sorry for the delay.

Have sent one patch to fix this issue, could you please take a look at it?

Thanks,

Quoted 3 lines

Honza