inode.c (549c7297717c32ee53f156cd949e055e601f67bb) | inode.c (14f3db5542e62bcf6fe088a09760ac52d55306c5) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * linux/fs/ext4/inode.c 4 * 5 * Copyright (C) 1992, 1993, 1994, 1995 6 * Remy Card (card@masi.ibp.fr) 7 * Laboratoire MASI - Institut Blaise Pascal 8 * Universite Pierre et Marie Curie (Paris VI) --- 6 unchanged lines hidden (view full) --- 15 * 16 * 64-bit file support on 64-bit platforms by Jakub Jelinek 17 * (jj@sunsite.ms.mff.cuni.cz) 18 * 19 * Assorted race fixes, rewrite of ext4_get_block() by Al Viro, 2000 20 */ 21 22#include <linux/fs.h> | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * linux/fs/ext4/inode.c 4 * 5 * Copyright (C) 1992, 1993, 1994, 1995 6 * Remy Card (card@masi.ibp.fr) 7 * Laboratoire MASI - Institut Blaise Pascal 8 * Universite Pierre et Marie Curie (Paris VI) --- 6 unchanged lines hidden (view full) --- 15 * 16 * 64-bit file support on 64-bit platforms by Jakub Jelinek 17 * (jj@sunsite.ms.mff.cuni.cz) 18 * 19 * Assorted race fixes, rewrite of ext4_get_block() by Al Viro, 2000 20 */ 21 22#include <linux/fs.h> |
23#include <linux/mount.h> |
|
23#include <linux/time.h> 24#include <linux/highuid.h> 25#include <linux/pagemap.h> 26#include <linux/dax.h> 27#include <linux/quotaops.h> 28#include <linux/string.h> 29#include <linux/buffer_head.h> 30#include <linux/writeback.h> --- 5302 unchanged lines hidden (view full) --- 5333 if (unlikely(IS_IMMUTABLE(inode))) 5334 return -EPERM; 5335 5336 if (unlikely(IS_APPEND(inode) && 5337 (ia_valid & (ATTR_MODE | ATTR_UID | 5338 ATTR_GID | ATTR_TIMES_SET)))) 5339 return -EPERM; 5340 | 24#include <linux/time.h> 25#include <linux/highuid.h> 26#include <linux/pagemap.h> 27#include <linux/dax.h> 28#include <linux/quotaops.h> 29#include <linux/string.h> 30#include <linux/buffer_head.h> 31#include <linux/writeback.h> --- 5302 unchanged lines hidden (view full) --- 5334 if (unlikely(IS_IMMUTABLE(inode))) 5335 return -EPERM; 5336 5337 if (unlikely(IS_APPEND(inode) && 5338 (ia_valid & (ATTR_MODE | ATTR_UID | 5339 ATTR_GID | ATTR_TIMES_SET)))) 5340 return -EPERM; 5341 |
5341 error = setattr_prepare(&init_user_ns, dentry, attr); | 5342 error = setattr_prepare(mnt_userns, dentry, attr); |
5342 if (error) 5343 return error; 5344 5345 error = fscrypt_prepare_setattr(dentry, attr); 5346 if (error) 5347 return error; 5348 5349 error = fsverity_prepare_setattr(dentry, attr); --- 158 unchanged lines hidden (view full) --- 5508 if (rc) 5509 error = rc; 5510 } 5511out_mmap_sem: 5512 up_write(&EXT4_I(inode)->i_mmap_sem); 5513 } 5514 5515 if (!error) { | 5343 if (error) 5344 return error; 5345 5346 error = fscrypt_prepare_setattr(dentry, attr); 5347 if (error) 5348 return error; 5349 5350 error = fsverity_prepare_setattr(dentry, attr); --- 158 unchanged lines hidden (view full) --- 5509 if (rc) 5510 error = rc; 5511 } 5512out_mmap_sem: 5513 up_write(&EXT4_I(inode)->i_mmap_sem); 5514 } 5515 5516 if (!error) { |
5516 setattr_copy(&init_user_ns, inode, attr); | 5517 setattr_copy(mnt_userns, inode, attr); |
5517 mark_inode_dirty(inode); 5518 } 5519 5520 /* 5521 * If the call to ext4_truncate failed to get a transaction handle at 5522 * all, we need to clean up the in-core orphan list manually. 5523 */ 5524 if (orphan && inode->i_nlink) 5525 ext4_orphan_del(NULL, inode); 5526 5527 if (!error && (ia_valid & ATTR_MODE)) | 5518 mark_inode_dirty(inode); 5519 } 5520 5521 /* 5522 * If the call to ext4_truncate failed to get a transaction handle at 5523 * all, we need to clean up the in-core orphan list manually. 5524 */ 5525 if (orphan && inode->i_nlink) 5526 ext4_orphan_del(NULL, inode); 5527 5528 if (!error && (ia_valid & ATTR_MODE)) |
5528 rc = posix_acl_chmod(&init_user_ns, inode, inode->i_mode); | 5529 rc = posix_acl_chmod(mnt_userns, inode, inode->i_mode); |
5529 5530err_out: 5531 if (error) 5532 ext4_std_error(inode->i_sb, error); 5533 if (!error) 5534 error = rc; 5535 ext4_fc_stop_update(inode); 5536 return error; --- 30 unchanged lines hidden (view full) --- 5567 5568 stat->attributes_mask |= (STATX_ATTR_APPEND | 5569 STATX_ATTR_COMPRESSED | 5570 STATX_ATTR_ENCRYPTED | 5571 STATX_ATTR_IMMUTABLE | 5572 STATX_ATTR_NODUMP | 5573 STATX_ATTR_VERITY); 5574 | 5530 5531err_out: 5532 if (error) 5533 ext4_std_error(inode->i_sb, error); 5534 if (!error) 5535 error = rc; 5536 ext4_fc_stop_update(inode); 5537 return error; --- 30 unchanged lines hidden (view full) --- 5568 5569 stat->attributes_mask |= (STATX_ATTR_APPEND | 5570 STATX_ATTR_COMPRESSED | 5571 STATX_ATTR_ENCRYPTED | 5572 STATX_ATTR_IMMUTABLE | 5573 STATX_ATTR_NODUMP | 5574 STATX_ATTR_VERITY); 5575 |
5575 generic_fillattr(&init_user_ns, inode, stat); | 5576 generic_fillattr(mnt_userns, inode, stat); |
5576 return 0; 5577} 5578 5579int ext4_file_getattr(struct user_namespace *mnt_userns, 5580 const struct path *path, struct kstat *stat, 5581 u32 request_mask, unsigned int query_flags) 5582{ 5583 struct inode *inode = d_inode(path->dentry); 5584 u64 delalloc_blocks; 5585 | 5577 return 0; 5578} 5579 5580int ext4_file_getattr(struct user_namespace *mnt_userns, 5581 const struct path *path, struct kstat *stat, 5582 u32 request_mask, unsigned int query_flags) 5583{ 5584 struct inode *inode = d_inode(path->dentry); 5585 u64 delalloc_blocks; 5586 |
5586 ext4_getattr(&init_user_ns, path, stat, request_mask, query_flags); | 5587 ext4_getattr(mnt_userns, path, stat, request_mask, query_flags); |
5587 5588 /* 5589 * If there is inline data in the inode, the inode will normally not 5590 * have data blocks allocated (it may have an external xattr block). 5591 * Report at least one sector for such files, so tools like tar, rsync, 5592 * others don't incorrectly think the file is completely sparse. 5593 */ 5594 if (unlikely(ext4_has_inline_data(inode))) --- 617 unchanged lines hidden --- | 5588 5589 /* 5590 * If there is inline data in the inode, the inode will normally not 5591 * have data blocks allocated (it may have an external xattr block). 5592 * Report at least one sector for such files, so tools like tar, rsync, 5593 * others don't incorrectly think the file is completely sparse. 5594 */ 5595 if (unlikely(ext4_has_inline_data(inode))) --- 617 unchanged lines hidden --- |