Re: [PATCH] ext2: initialize quota info in ext2_xattr_set()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



在 7/8/2020 6:52 PM, Ritesh Harjani 写道:


On 6/26/20 11:19 AM, Chengguang Xu wrote:
In order to correctly account/limit space usage, should initialize
quota info before calling quota related functions.

How did you encounter the problem?
Any test case got hit?

I found the issue by code inspecting when I was learning mbcache logic.

Thanks,
cgxu



Signed-off-by: Chengguang Xu <cgxu519@xxxxxxxxxxxx>

LGTM, feel free to add
Reviewed-by: Reviewed-by: Ritesh Harjani <riteshh@xxxxxxxxxxxxx>


---
  fs/ext2/xattr.c | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c
index 943cc469f42f..913e5c4921ec 100644
--- a/fs/ext2/xattr.c
+++ b/fs/ext2/xattr.c
@@ -437,6 +437,9 @@ ext2_xattr_set(struct inode *inode, int name_index, const char *name,
      name_len = strlen(name);
      if (name_len > 255 || value_len > sb->s_blocksize)
          return -ERANGE;
+    error = dquot_initialize(inode);
+    if (error)
+        return error;
      down_write(&EXT2_I(inode)->xattr_sem);
      if (EXT2_I(inode)->i_file_acl) {
          /* The inode already has an extended attribute block. */







[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux