mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 19:51:31 -04:00
quota: unify quota init condition in setattr
Quota must being initialized if size or uid/git changes requested. But initialization performed in two different places: in case of i_size file system is responsible for dquot init , but in case of uid/gid init will be called internally in dquot_transfer(). This ambiguity makes code harder to understand. Let's move this logic to one common helper function. Signed-off-by: Dmitry Monakhov <[email protected]> Signed-off-by: Jan Kara <[email protected]>
This commit is contained in:
parent
fcbc59f96e
commit
12755627bd
10 changed files with 23 additions and 15 deletions
|
|
@ -518,18 +518,18 @@ int ufs_setattr(struct dentry *dentry, struct iattr *attr)
|
|||
if (error)
|
||||
return error;
|
||||
|
||||
if (is_quota_modification(inode, attr))
|
||||
dquot_initialize(inode);
|
||||
|
||||
if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
|
||||
(ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) {
|
||||
error = dquot_transfer(inode, attr);
|
||||
if (error)
|
||||
return error;
|
||||
}
|
||||
if (ia_valid & ATTR_SIZE &&
|
||||
attr->ia_size != i_size_read(inode)) {
|
||||
if (ia_valid & ATTR_SIZE && attr->ia_size != inode->i_size) {
|
||||
loff_t old_i_size = inode->i_size;
|
||||
|
||||
dquot_initialize(inode);
|
||||
|
||||
error = vmtruncate(inode, attr->ia_size);
|
||||
if (error)
|
||||
return error;
|
||||
|
|
|
|||
Loading…
Reference in a new issue