Skip to content

Commit 68c2f35

Browse files
committed
Merge tag 'for-f2fs-4.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs
Pull f2fs fixes from Jaegeuk Kim: "Fix a performance regression and a bug" * tag 'for-f2fs-4.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs: f2fs: fix wrong error hanlder in f2fs_follow_link Revert "f2fs: enhance multi-threads performance"
2 parents fbb7b92 + 7263b1b commit 68c2f35

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

fs/f2fs/data.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1513,6 +1513,7 @@ static int f2fs_write_data_pages(struct address_space *mapping,
15131513
{
15141514
struct inode *inode = mapping->host;
15151515
struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
1516+
bool locked = false;
15161517
int ret;
15171518
long diff;
15181519

@@ -1533,7 +1534,13 @@ static int f2fs_write_data_pages(struct address_space *mapping,
15331534

15341535
diff = nr_pages_to_write(sbi, DATA, wbc);
15351536

1537+
if (!S_ISDIR(inode->i_mode)) {
1538+
mutex_lock(&sbi->writepages);
1539+
locked = true;
1540+
}
15361541
ret = write_cache_pages(mapping, wbc, __f2fs_writepage, mapping);
1542+
if (locked)
1543+
mutex_unlock(&sbi->writepages);
15371544

15381545
f2fs_submit_merged_bio(sbi, DATA, WRITE);
15391546

fs/f2fs/f2fs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,7 @@ struct f2fs_sb_info {
625625
struct mutex cp_mutex; /* checkpoint procedure lock */
626626
struct rw_semaphore cp_rwsem; /* blocking FS operations */
627627
struct rw_semaphore node_write; /* locking node writes */
628+
struct mutex writepages; /* mutex for writepages() */
628629
wait_queue_head_t cp_wait;
629630

630631
struct inode_management im[MAX_INO_ENTRY]; /* manage inode cache */

fs/f2fs/namei.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -298,16 +298,14 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry)
298298

299299
static void *f2fs_follow_link(struct dentry *dentry, struct nameidata *nd)
300300
{
301-
struct page *page;
301+
struct page *page = page_follow_link_light(dentry, nd);
302302

303-
page = page_follow_link_light(dentry, nd);
304-
if (IS_ERR(page))
303+
if (IS_ERR_OR_NULL(page))
305304
return page;
306305

307306
/* this is broken symlink case */
308307
if (*nd_get_link(nd) == 0) {
309-
kunmap(page);
310-
page_cache_release(page);
308+
page_put_link(dentry, nd, page);
311309
return ERR_PTR(-ENOENT);
312310
}
313311
return page;

fs/f2fs/super.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,6 +1035,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
10351035
sbi->raw_super = raw_super;
10361036
sbi->raw_super_buf = raw_super_buf;
10371037
mutex_init(&sbi->gc_mutex);
1038+
mutex_init(&sbi->writepages);
10381039
mutex_init(&sbi->cp_mutex);
10391040
init_rwsem(&sbi->node_write);
10401041
clear_sbi_flag(sbi, SBI_POR_DOING);

0 commit comments

Comments
 (0)