Forwarded: #syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 43e9ad0c55a369ecc84a4788d06a8a6bfa634f1c

syzbot posted 1 patch 3 months, 2 weeks ago
There is a newer version of this series
Forwarded: #syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 43e9ad0c55a369ecc84a4788d06a8a6bfa634f1c
Posted by syzbot 3 months, 2 weeks ago
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.

***

Subject: #syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 43e9ad0c55a369ecc84a4788d06a8a6bfa634f1c
Author: dmantipov@yandex.ru

diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
index fcc89856ab95..60ff8b3068d1 100644
--- a/fs/ocfs2/inode.c
+++ b/fs/ocfs2/inode.c
@@ -859,23 +859,37 @@ static int ocfs2_wipe_inode(struct inode *inode,
 		}
 	}
 
-	/* we do this while holding the orphan dir lock because we
-	 * don't want recovery being run from another node to try an
-	 * inode delete underneath us -- this will result in two nodes
-	 * truncating the same file! */
-	status = ocfs2_truncate_for_delete(osb, inode, di_bh);
-	if (status < 0) {
-		mlog_errno(status);
-		goto bail_unlock_dir;
-	}
-
-	/* Remove any dir index tree */
-	if (S_ISDIR(inode->i_mode)) {
-		status = ocfs2_dx_dir_truncate(inode, di_bh);
+	if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) {
+		/* Short circuit for an inode with inline data,
+		 * do this just like in ocfs2_truncate_file().
+		 */
+		unmap_mapping_range(inode->i_mapping, PAGE_SIZE - 1, 0, 1);
+		truncate_inode_pages(inode->i_mapping, 0);
+		status = ocfs2_truncate_inline(inode, di_bh, 0,
+					       i_size_read(inode), 1);
 		if (status) {
+			mlog_errno(status);
+			goto bail;
+		}
+	} else {
+		/* we do this while holding the orphan dir lock because we
+		 * don't want recovery being run from another node to try an
+		 * inode delete underneath us -- this will result in two nodes
+		 * truncating the same file! */
+		status = ocfs2_truncate_for_delete(osb, inode, di_bh);
+		if (status < 0) {
 			mlog_errno(status);
 			goto bail_unlock_dir;
 		}
+
+		/* Remove any dir index tree */
+		if (S_ISDIR(inode->i_mode)) {
+			status = ocfs2_dx_dir_truncate(inode, di_bh);
+			if (status) {
+				mlog_errno(status);
+				goto bail_unlock_dir;
+			}
+		}
 	}
 
 	/*Free extended attribute resources associated with this inode.*/