linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@sandeen.net>
To: Eric Sandeen <sandeen@redhat.com>, linux-xfs <linux-xfs@vger.kernel.org>
Subject: [PATCH 5/5] xfs_io: fix inode command with "-n" for bogus inode
Date: Fri, 30 Sep 2016 15:57:28 -0500	[thread overview]
Message-ID: <26464bd7-f56c-733f-108d-13dca26ceb7c@sandeen.net> (raw)
In-Reply-To: <9f126dc7-3b1e-a1ed-7f23-48410a76adc2@redhat.com>

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@redhat.com>
---
 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


      parent reply	other threads:[~2016-09-30 20:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-30 20:50 [PATCH 0/5] xfs_io: address various "inode" command issues Eric Sandeen
2016-09-30 20:52 ` [PATCH 1/5] xfs_io: fix inode command help and argsmax Eric Sandeen
2016-09-30 20:53 ` [PATCH 2/5] xfs_io: factor out new get_last_inode() helper Eric Sandeen
2016-09-30 20:54 ` [PATCH 3/5] xfs_io: move inode command arg handling to top Eric Sandeen
2016-09-30 20:56 ` [PATCH 4/5] xfs_io: refactor inode command Eric Sandeen
2016-09-30 20:57 ` Eric Sandeen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=26464bd7-f56c-733f-108d-13dca26ceb7c@sandeen.net \
    --to=sandeen@sandeen.net \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).