mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 18:13:41 +02:00
Fix some ext4 bug fixes and regressions relating to oneline resize and
fast commits. -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEK2m5VNv+CHkogTfJ8vlZVpUNgaMFAmcAYaIACgkQ8vlZVpUN gaO8fQf+IOHRpyqVBXd2WwDJ05vBJAbbaKdhaI1r6gFPF1AzyIZ+lpCnEV9f9B2u IrDZaigb/CiJxO9mLRLrp0z/O9s6Z/+NjNdVFkoynJo2Crfr5mi07DXR9EQ7XkvT WYcT0IXg7xVswOzVosgBOUA76yMLJwtuTPp7YsAmCmp5EksMk1LSk1VzUEJcKRgJ BHSWSn2BqHxwMStB5L0eBnYtdaW8l1RLeWlTPdcPeCrD7UrYCXThvxfyz2KdztBz YfjcQEZhY6OD/uKdNFE6oQc54kL8RpqGDpF3YGMBixiZ8h99PpGUUz3bB5VLTfco WlxQwOD9dofPQ5Yh+s5icY8q67XXow== =Cnp+ -----END PGP SIGNATURE----- Merge tag 'ext4_for_linus-5.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4 Pull ext4 fixes from Ted Ts'o: "Fix some ext4 bugs and regressions relating to oneline resize and fast commits" * tag 'ext4_for_linus-5.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: ext4: fix off by one issue in alloc_flex_gd() ext4: mark fc as ineligible using an handle in ext4_xattr_set() ext4: use handle to mark fc as ineligible in __track_dentry_update()
This commit is contained in:
commit
fdd0a94dcf
|
|
@ -379,7 +379,7 @@ void ext4_fc_mark_ineligible(struct super_block *sb, int reason, handle_t *handl
|
|||
*/
|
||||
static int ext4_fc_track_template(
|
||||
handle_t *handle, struct inode *inode,
|
||||
int (*__fc_track_fn)(struct inode *, void *, bool),
|
||||
int (*__fc_track_fn)(handle_t *handle, struct inode *, void *, bool),
|
||||
void *args, int enqueue)
|
||||
{
|
||||
bool update = false;
|
||||
|
|
@ -396,7 +396,7 @@ static int ext4_fc_track_template(
|
|||
ext4_fc_reset_inode(inode);
|
||||
ei->i_sync_tid = tid;
|
||||
}
|
||||
ret = __fc_track_fn(inode, args, update);
|
||||
ret = __fc_track_fn(handle, inode, args, update);
|
||||
mutex_unlock(&ei->i_fc_lock);
|
||||
|
||||
if (!enqueue)
|
||||
|
|
@ -420,7 +420,8 @@ struct __track_dentry_update_args {
|
|||
};
|
||||
|
||||
/* __track_fn for directory entry updates. Called with ei->i_fc_lock. */
|
||||
static int __track_dentry_update(struct inode *inode, void *arg, bool update)
|
||||
static int __track_dentry_update(handle_t *handle, struct inode *inode,
|
||||
void *arg, bool update)
|
||||
{
|
||||
struct ext4_fc_dentry_update *node;
|
||||
struct ext4_inode_info *ei = EXT4_I(inode);
|
||||
|
|
@ -435,14 +436,14 @@ static int __track_dentry_update(struct inode *inode, void *arg, bool update)
|
|||
|
||||
if (IS_ENCRYPTED(dir)) {
|
||||
ext4_fc_mark_ineligible(sb, EXT4_FC_REASON_ENCRYPTED_FILENAME,
|
||||
NULL);
|
||||
handle);
|
||||
mutex_lock(&ei->i_fc_lock);
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
node = kmem_cache_alloc(ext4_fc_dentry_cachep, GFP_NOFS);
|
||||
if (!node) {
|
||||
ext4_fc_mark_ineligible(sb, EXT4_FC_REASON_NOMEM, NULL);
|
||||
ext4_fc_mark_ineligible(sb, EXT4_FC_REASON_NOMEM, handle);
|
||||
mutex_lock(&ei->i_fc_lock);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
|
@ -454,7 +455,7 @@ static int __track_dentry_update(struct inode *inode, void *arg, bool update)
|
|||
node->fcd_name.name = kmalloc(dentry->d_name.len, GFP_NOFS);
|
||||
if (!node->fcd_name.name) {
|
||||
kmem_cache_free(ext4_fc_dentry_cachep, node);
|
||||
ext4_fc_mark_ineligible(sb, EXT4_FC_REASON_NOMEM, NULL);
|
||||
ext4_fc_mark_ineligible(sb, EXT4_FC_REASON_NOMEM, handle);
|
||||
mutex_lock(&ei->i_fc_lock);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
|
@ -576,7 +577,8 @@ void ext4_fc_track_create(handle_t *handle, struct dentry *dentry)
|
|||
}
|
||||
|
||||
/* __track_fn for inode tracking */
|
||||
static int __track_inode(struct inode *inode, void *arg, bool update)
|
||||
static int __track_inode(handle_t *handle, struct inode *inode, void *arg,
|
||||
bool update)
|
||||
{
|
||||
if (update)
|
||||
return -EEXIST;
|
||||
|
|
@ -614,7 +616,8 @@ struct __track_range_args {
|
|||
};
|
||||
|
||||
/* __track_fn for tracking data updates */
|
||||
static int __track_range(struct inode *inode, void *arg, bool update)
|
||||
static int __track_range(handle_t *handle, struct inode *inode, void *arg,
|
||||
bool update)
|
||||
{
|
||||
struct ext4_inode_info *ei = EXT4_I(inode);
|
||||
ext4_lblk_t oldstart;
|
||||
|
|
|
|||
|
|
@ -230,8 +230,8 @@ struct ext4_new_flex_group_data {
|
|||
#define MAX_RESIZE_BG 16384
|
||||
|
||||
/*
|
||||
* alloc_flex_gd() allocates a ext4_new_flex_group_data with size of
|
||||
* @flexbg_size.
|
||||
* alloc_flex_gd() allocates an ext4_new_flex_group_data that satisfies the
|
||||
* resizing from @o_group to @n_group, its size is typically @flexbg_size.
|
||||
*
|
||||
* Returns NULL on failure otherwise address of the allocated structure.
|
||||
*/
|
||||
|
|
@ -239,25 +239,27 @@ static struct ext4_new_flex_group_data *alloc_flex_gd(unsigned int flexbg_size,
|
|||
ext4_group_t o_group, ext4_group_t n_group)
|
||||
{
|
||||
ext4_group_t last_group;
|
||||
unsigned int max_resize_bg;
|
||||
struct ext4_new_flex_group_data *flex_gd;
|
||||
|
||||
flex_gd = kmalloc(sizeof(*flex_gd), GFP_NOFS);
|
||||
if (flex_gd == NULL)
|
||||
goto out3;
|
||||
|
||||
if (unlikely(flexbg_size > MAX_RESIZE_BG))
|
||||
flex_gd->resize_bg = MAX_RESIZE_BG;
|
||||
else
|
||||
flex_gd->resize_bg = flexbg_size;
|
||||
max_resize_bg = umin(flexbg_size, MAX_RESIZE_BG);
|
||||
flex_gd->resize_bg = max_resize_bg;
|
||||
|
||||
/* Avoid allocating large 'groups' array if not needed */
|
||||
last_group = o_group | (flex_gd->resize_bg - 1);
|
||||
if (n_group <= last_group)
|
||||
flex_gd->resize_bg = 1 << fls(n_group - o_group + 1);
|
||||
flex_gd->resize_bg = 1 << fls(n_group - o_group);
|
||||
else if (n_group - last_group < flex_gd->resize_bg)
|
||||
flex_gd->resize_bg = 1 << max(fls(last_group - o_group + 1),
|
||||
flex_gd->resize_bg = 1 << max(fls(last_group - o_group),
|
||||
fls(n_group - last_group));
|
||||
|
||||
if (WARN_ON_ONCE(flex_gd->resize_bg > max_resize_bg))
|
||||
flex_gd->resize_bg = max_resize_bg;
|
||||
|
||||
flex_gd->groups = kmalloc_array(flex_gd->resize_bg,
|
||||
sizeof(struct ext4_new_group_data),
|
||||
GFP_NOFS);
|
||||
|
|
|
|||
|
|
@ -2559,6 +2559,8 @@ ext4_xattr_set(struct inode *inode, int name_index, const char *name,
|
|||
|
||||
error = ext4_xattr_set_handle(handle, inode, name_index, name,
|
||||
value, value_len, flags);
|
||||
ext4_fc_mark_ineligible(inode->i_sb, EXT4_FC_REASON_XATTR,
|
||||
handle);
|
||||
error2 = ext4_journal_stop(handle);
|
||||
if (error == -ENOSPC &&
|
||||
ext4_should_retry_alloc(sb, &retries))
|
||||
|
|
@ -2566,7 +2568,6 @@ ext4_xattr_set(struct inode *inode, int name_index, const char *name,
|
|||
if (error == 0)
|
||||
error = error2;
|
||||
}
|
||||
ext4_fc_mark_ineligible(inode->i_sb, EXT4_FC_REASON_XATTR, NULL);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user