remove inode_setattr
Replace inode_setattr with opencoded variants of it in all callers. This moves the remaining call to vmtruncate into the filesystem methods where it can be replaced with the proper truncate sequence. In a few cases it was obvious that we would never end up calling vmtruncate so it was left out in the opencoded variant: spufs: explicitly checks for ATTR_SIZE earlier btrfs,hugetlbfs,logfs,dlmfs: explicitly clears ATTR_SIZE earlier ufs: contains an opencoded simple_seattr + truncate that sets the filesize just above In addition to that ncpfs called inode_setattr with handcrafted iattrs, which allowed to trim down the opencoded variant. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Este cometimento está contido em:

cometido por
Al Viro

ascendente
eef2380c18
cometimento
1025774ce4
@@ -5539,11 +5539,19 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr)
|
||||
ext4_truncate(inode);
|
||||
}
|
||||
|
||||
rc = inode_setattr(inode, attr);
|
||||
if ((attr->ia_valid & ATTR_SIZE) &&
|
||||
attr->ia_size != i_size_read(inode))
|
||||
rc = vmtruncate(inode, attr->ia_size);
|
||||
|
||||
/* If inode_setattr's call to ext4_truncate failed to get a
|
||||
* transaction handle at all, we need to clean up the in-core
|
||||
* orphan list manually. */
|
||||
if (!rc) {
|
||||
setattr_copy(inode, attr);
|
||||
mark_inode_dirty(inode);
|
||||
}
|
||||
|
||||
/*
|
||||
* If the call to ext4_truncate failed to get a transaction handle at
|
||||
* all, we need to clean up the in-core orphan list manually.
|
||||
*/
|
||||
if (inode->i_nlink)
|
||||
ext4_orphan_del(NULL, inode);
|
||||
|
||||
|
Criar uma nova questão referindo esta
Bloquear um utilizador