lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1386323897-2354-18-git-send-email-wenqing.lz@taobao.com>
Date:	Fri,  6 Dec 2013 17:58:04 +0800
From:	Zheng Liu <gnehzuil.liu@...il.com>
To:	linux-ext4@...r.kernel.org
Cc:	Theodore Ts'o <tytso@....edu>,
	"Darrick J. Wong" <darrick.wong@...cle.com>,
	Zheng Liu <wenqing.lz@...bao.com>
Subject: [PATCH v3 17/30] debugfs: handle inline_data feature in bmap command

From: Zheng Liu <wenqing.lz@...bao.com>

No physical block mapping if an inode has inline data.

Meanwhile this commit fixes a minor bug in bmap command when it prints
an error.

Signed-off-by: Theodore Ts'o <tytso@....edu>
Signed-off-by: Zheng Liu <wenqing.lz@...bao.com>
---
 debugfs/debugfs.c         |    2 +-
 lib/ext2fs/bmap.c         |    7 +++++++
 lib/ext2fs/ext2_err.et.in |    3 +++
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c
index ef5f201..bc8413d 100644
--- a/debugfs/debugfs.c
+++ b/debugfs/debugfs.c
@@ -2135,7 +2135,7 @@ void do_bmap(int argc, char *argv[])
 
 	errcode = ext2fs_bmap2(current_fs, ino, 0, 0, 0, blk, 0, &pblk);
 	if (errcode) {
-		com_err("argv[0]", errcode,
+		com_err(argv[0], errcode,
 			"while mapping logical block %llu\n", blk);
 		return;
 	}
diff --git a/lib/ext2fs/bmap.c b/lib/ext2fs/bmap.c
index 5074587..e148dba 100644
--- a/lib/ext2fs/bmap.c
+++ b/lib/ext2fs/bmap.c
@@ -266,6 +266,13 @@ errcode_t ext2fs_bmap2(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode,
 	}
 	addr_per_block = (blk_t) fs->blocksize >> 2;
 
+	/*
+	 * If an inode has inline data, that means that it doesn't have
+	 * any blocks and we shouldn't map any blocks for it.
+	 */
+	if (inode->i_flags & EXT4_INLINE_DATA_FL)
+		return EXT2_ET_INLINE_DATA_NO_BLOCK;
+
 	if (!block_buf) {
 		retval = ext2fs_get_array(2, fs->blocksize, &buf);
 		if (retval)
diff --git a/lib/ext2fs/ext2_err.et.in b/lib/ext2fs/ext2_err.et.in
index 0781145..f93f0e8 100644
--- a/lib/ext2fs/ext2_err.et.in
+++ b/lib/ext2fs/ext2_err.et.in
@@ -503,4 +503,7 @@ ec	EXT2_ET_EA_NO_SPACE,
 ec	EXT2_ET_NO_INLINE_DATA,
 	"Inode doesn't have inline data"
 
+ec	EXT2_ET_INLINE_DATA_NO_BLOCK,
+	"No block for an inode with inline data"
+
 	end
-- 
1.7.9.7

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ