Skip to content

Commit 48d546a

Browse files
morbidrsadamien-lemoal
authored andcommitted
zonefs: provide no-lock zonefs_io_error variant
Subsequent patches need to call zonefs_io_error() with the i_truncate_mutex already held, so factor out the body of zonefs_io_error() into __zonefs_io_error() which can be called from with the i_truncate_mutex held. Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com> Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
1 parent 5498d5f commit 48d546a

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

fs/zonefs/super.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ static int zonefs_io_error_cb(struct blk_zone *zone, unsigned int idx,
348348
* eventually correct the file size and zonefs inode write pointer offset
349349
* (which can be out of sync with the drive due to partial write failures).
350350
*/
351-
static void zonefs_io_error(struct inode *inode, bool write)
351+
static void __zonefs_io_error(struct inode *inode, bool write)
352352
{
353353
struct zonefs_inode_info *zi = ZONEFS_I(inode);
354354
struct super_block *sb = inode->i_sb;
@@ -362,8 +362,6 @@ static void zonefs_io_error(struct inode *inode, bool write)
362362
};
363363
int ret;
364364

365-
mutex_lock(&zi->i_truncate_mutex);
366-
367365
/*
368366
* Memory allocations in blkdev_report_zones() can trigger a memory
369367
* reclaim which may in turn cause a recursion into zonefs as well as
@@ -379,7 +377,14 @@ static void zonefs_io_error(struct inode *inode, bool write)
379377
zonefs_err(sb, "Get inode %lu zone information failed %d\n",
380378
inode->i_ino, ret);
381379
memalloc_noio_restore(noio_flag);
380+
}
382381

382+
static void zonefs_io_error(struct inode *inode, bool write)
383+
{
384+
struct zonefs_inode_info *zi = ZONEFS_I(inode);
385+
386+
mutex_lock(&zi->i_truncate_mutex);
387+
__zonefs_io_error(inode, write);
383388
mutex_unlock(&zi->i_truncate_mutex);
384389
}
385390

0 commit comments

Comments
 (0)