From: Darrick J. Wong Date: Thu, 11 Sep 2014 15:45:12 +0000 (-0400) Subject: ext4: don't keep using page if inline conversion fails X-Git-Tag: firefly_0821_release~176^2~2990^2~24 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=684de5748660e16e185754697ac0afa9e18297f6;p=firefly-linux-kernel-4.4.55.git ext4: don't keep using page if inline conversion fails If inline->extent conversion fails (most probably due to ENOSPC) and we release the temporary page that we allocated to transfer the file contents, don't keep using the page pointer after releasing the page. This occasionally leads to complaints about evicting locked pages or hangs when blocksize > pagesize, because it's possible for the page to get reallocated elsewhere in the meantime. Signed-off-by: Darrick J. Wong Signed-off-by: Theodore Ts'o Reviewed-by: Jan Kara Cc: Tao Ma --- diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c index bea662bd0ca6..378aadf5e6db 100644 --- a/fs/ext4/inline.c +++ b/fs/ext4/inline.c @@ -594,6 +594,7 @@ retry: if (ret) { unlock_page(page); page_cache_release(page); + page = NULL; ext4_orphan_add(handle, inode); up_write(&EXT4_I(inode)->xattr_sem); sem_held = 0; @@ -613,7 +614,8 @@ retry: if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries)) goto retry; - block_commit_write(page, from, to); + if (page) + block_commit_write(page, from, to); out: if (page) { unlock_page(page);