Loading fs/attr.c +15 −0 Original line number Original line Diff line number Diff line Loading @@ -202,6 +202,21 @@ int notify_change(struct dentry * dentry, struct iattr * attr, struct inode **de return -EPERM; return -EPERM; } } /* * If utimes(2) and friends are called with times == NULL (or both * times are UTIME_NOW), then we need to check for write permission */ if (ia_valid & ATTR_TOUCH) { if (IS_IMMUTABLE(inode)) return -EPERM; if (!inode_owner_or_capable(inode)) { error = inode_permission(inode, MAY_WRITE); if (error) return error; } } if ((ia_valid & ATTR_MODE)) { if ((ia_valid & ATTR_MODE)) { umode_t amode = attr->ia_mode; umode_t amode = attr->ia_mode; /* Flag setting protected by i_mutex */ /* Flag setting protected by i_mutex */ Loading fs/btrfs/ctree.h +0 −1 Original line number Original line Diff line number Diff line Loading @@ -3161,7 +3161,6 @@ int btrfs_prealloc_file_range_trans(struct inode *inode, struct btrfs_trans_handle *trans, int mode, struct btrfs_trans_handle *trans, int mode, u64 start, u64 num_bytes, u64 min_size, u64 start, u64 num_bytes, u64 min_size, loff_t actual_len, u64 *alloc_hint); loff_t actual_len, u64 *alloc_hint); int btrfs_inode_check_errors(struct inode *inode); extern const struct dentry_operations btrfs_dentry_operations; extern const struct dentry_operations btrfs_dentry_operations; #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS void btrfs_test_inode_set_ops(struct inode *inode); void btrfs_test_inode_set_ops(struct inode *inode); Loading fs/btrfs/file.c +1 −1 Original line number Original line Diff line number Diff line Loading @@ -2040,7 +2040,7 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) * flags for any errors that might have happened while doing * flags for any errors that might have happened while doing * writeback of file data. * writeback of file data. */ */ ret = btrfs_inode_check_errors(inode); ret = filemap_check_errors(inode->i_mapping); inode_unlock(inode); inode_unlock(inode); goto out; goto out; } } Loading fs/btrfs/inode.c +0 −15 Original line number Original line Diff line number Diff line Loading @@ -10543,21 +10543,6 @@ static int btrfs_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) } } /* Inspired by filemap_check_errors() */ int btrfs_inode_check_errors(struct inode *inode) { int ret = 0; if (test_bit(AS_ENOSPC, &inode->i_mapping->flags) && test_and_clear_bit(AS_ENOSPC, &inode->i_mapping->flags)) ret = -ENOSPC; if (test_bit(AS_EIO, &inode->i_mapping->flags) && test_and_clear_bit(AS_EIO, &inode->i_mapping->flags)) ret = -EIO; return ret; } static const struct inode_operations btrfs_dir_inode_operations = { static const struct inode_operations btrfs_dir_inode_operations = { .getattr = btrfs_getattr, .getattr = btrfs_getattr, .lookup = btrfs_lookup, .lookup = btrfs_lookup, Loading fs/btrfs/tree-log.c +2 −2 Original line number Original line Diff line number Diff line Loading @@ -3961,7 +3961,7 @@ static int wait_ordered_extents(struct btrfs_trans_handle *trans, * i_mapping flags, so that the next fsync won't get * i_mapping flags, so that the next fsync won't get * an outdated io error too. * an outdated io error too. */ */ btrfs_inode_check_errors(inode); filemap_check_errors(inode->i_mapping); *ordered_io_error = true; *ordered_io_error = true; break; break; } } Loading Loading @@ -4198,7 +4198,7 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans, * without writing to the log tree and the fsync must report the * without writing to the log tree and the fsync must report the * file data write error and not commit the current transaction. * file data write error and not commit the current transaction. */ */ ret = btrfs_inode_check_errors(inode); ret = filemap_check_errors(inode->i_mapping); if (ret) if (ret) ctx->io_err = ret; ctx->io_err = ret; process: process: Loading Loading
fs/attr.c +15 −0 Original line number Original line Diff line number Diff line Loading @@ -202,6 +202,21 @@ int notify_change(struct dentry * dentry, struct iattr * attr, struct inode **de return -EPERM; return -EPERM; } } /* * If utimes(2) and friends are called with times == NULL (or both * times are UTIME_NOW), then we need to check for write permission */ if (ia_valid & ATTR_TOUCH) { if (IS_IMMUTABLE(inode)) return -EPERM; if (!inode_owner_or_capable(inode)) { error = inode_permission(inode, MAY_WRITE); if (error) return error; } } if ((ia_valid & ATTR_MODE)) { if ((ia_valid & ATTR_MODE)) { umode_t amode = attr->ia_mode; umode_t amode = attr->ia_mode; /* Flag setting protected by i_mutex */ /* Flag setting protected by i_mutex */ Loading
fs/btrfs/ctree.h +0 −1 Original line number Original line Diff line number Diff line Loading @@ -3161,7 +3161,6 @@ int btrfs_prealloc_file_range_trans(struct inode *inode, struct btrfs_trans_handle *trans, int mode, struct btrfs_trans_handle *trans, int mode, u64 start, u64 num_bytes, u64 min_size, u64 start, u64 num_bytes, u64 min_size, loff_t actual_len, u64 *alloc_hint); loff_t actual_len, u64 *alloc_hint); int btrfs_inode_check_errors(struct inode *inode); extern const struct dentry_operations btrfs_dentry_operations; extern const struct dentry_operations btrfs_dentry_operations; #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS void btrfs_test_inode_set_ops(struct inode *inode); void btrfs_test_inode_set_ops(struct inode *inode); Loading
fs/btrfs/file.c +1 −1 Original line number Original line Diff line number Diff line Loading @@ -2040,7 +2040,7 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) * flags for any errors that might have happened while doing * flags for any errors that might have happened while doing * writeback of file data. * writeback of file data. */ */ ret = btrfs_inode_check_errors(inode); ret = filemap_check_errors(inode->i_mapping); inode_unlock(inode); inode_unlock(inode); goto out; goto out; } } Loading
fs/btrfs/inode.c +0 −15 Original line number Original line Diff line number Diff line Loading @@ -10543,21 +10543,6 @@ static int btrfs_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) } } /* Inspired by filemap_check_errors() */ int btrfs_inode_check_errors(struct inode *inode) { int ret = 0; if (test_bit(AS_ENOSPC, &inode->i_mapping->flags) && test_and_clear_bit(AS_ENOSPC, &inode->i_mapping->flags)) ret = -ENOSPC; if (test_bit(AS_EIO, &inode->i_mapping->flags) && test_and_clear_bit(AS_EIO, &inode->i_mapping->flags)) ret = -EIO; return ret; } static const struct inode_operations btrfs_dir_inode_operations = { static const struct inode_operations btrfs_dir_inode_operations = { .getattr = btrfs_getattr, .getattr = btrfs_getattr, .lookup = btrfs_lookup, .lookup = btrfs_lookup, Loading
fs/btrfs/tree-log.c +2 −2 Original line number Original line Diff line number Diff line Loading @@ -3961,7 +3961,7 @@ static int wait_ordered_extents(struct btrfs_trans_handle *trans, * i_mapping flags, so that the next fsync won't get * i_mapping flags, so that the next fsync won't get * an outdated io error too. * an outdated io error too. */ */ btrfs_inode_check_errors(inode); filemap_check_errors(inode->i_mapping); *ordered_io_error = true; *ordered_io_error = true; break; break; } } Loading Loading @@ -4198,7 +4198,7 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans, * without writing to the log tree and the fsync must report the * without writing to the log tree and the fsync must report the * file data write error and not commit the current transaction. * file data write error and not commit the current transaction. */ */ ret = btrfs_inode_check_errors(inode); ret = filemap_check_errors(inode->i_mapping); if (ret) if (ret) ctx->io_err = ret; ctx->io_err = ret; process: process: Loading