From 6228f7cde7536943101bd1925a4e5cc59d04a332 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Mon, 16 Mar 2020 15:23:29 -0700 Subject: [PATCH] scoutfs: create offline extents after arg checks With the introduction of packed extent items the setattr_more ioctl had to be careful not to try and dirty all the extent items in one transaction. But it pulled the extent creation call up to high and was doing it before some argument checks that were done after the inode was refreshed by acquiring its lock. This moves the extent creation to be done after the args are verified for the inode. Signed-off-by: Zach Brown --- kmod/src/ioctl.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/kmod/src/ioctl.c b/kmod/src/ioctl.c index 148e7356..24317e73 100644 --- a/kmod/src/ioctl.c +++ b/kmod/src/ioctl.c @@ -590,13 +590,6 @@ static long scoutfs_ioc_setattr_more(struct file *file, unsigned long arg) if (ret) goto unlock; - /* create offline extents in potentially many transactions */ - if (sm.flags & SCOUTFS_IOC_SETATTR_MORE_OFFLINE) { - ret = scoutfs_data_init_offline_extent(inode, sm.i_size, lock); - if (ret) - goto unlock; - } - /* can only change size/dv on untouched regular files */ if ((sm.i_size != 0 || sm.data_version != 0) && ((!S_ISREG(inode->i_mode) || @@ -605,6 +598,13 @@ static long scoutfs_ioc_setattr_more(struct file *file, unsigned long arg) goto unlock; } + /* create offline extents in potentially many transactions */ + if (sm.flags & SCOUTFS_IOC_SETATTR_MORE_OFFLINE) { + ret = scoutfs_data_init_offline_extent(inode, sm.i_size, lock); + if (ret) + goto unlock; + } + /* setting only so we don't see 0 data seq with nonzero data_version */ set_data_seq = sm.data_version != 0 ? true : false; ret = scoutfs_inode_index_lock_hold(inode, &ind_locks, set_data_seq,