[PATCH 5/5] xfs_io: fix inode command with "-n" for bogus inode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If we ask for the next allocated inode after a number for which
no other inode exists, the bulkstat returns success, but with
count == 0.  If we ignore this fact, we print a garbage result
from bstat.bs_ino in this case, so fix it.

Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
---
 io/open.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/io/open.c b/io/open.c
index 7d952a0..4279062 100644
--- a/io/open.c
+++ b/io/open.c
@@ -882,10 +882,16 @@ inode_f(
 				exitcode = 1;
 				return 0;
 			}
-		} else if (ret_next)	/* The next inode in use */
-			result_ino = bstat.bs_ino;
-		else			/* The inode we asked about */
+		} else if (ret_next) {
+			/* The next inode in use, or 0 if none */
+			if (*bulkreq.ocount)
+				result_ino = bstat.bs_ino;
+			else
+				result_ino = 0;
+		} else {
+			/* The inode we asked about */
 			result_ino = userino;
+		}
 	}
 
 	if (verbose && result_ino) {
-- 
1.7.1

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



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux