cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Carlos Maiolino <cmaiolino@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 2/3] mkfs: Remove unneeded open/close fd	test from are_you_sure()
Date: Tue, 27 Sep 2011 14:37:07 -0300	[thread overview]
Message-ID: <20110927173706.GA3494@andromeda.usersys.redhat.com> (raw)
In-Reply-To: <4b264c31-d653-4699-93ba-0a2ecb8e2848@zmail06.collab.prod.int.phx2.redhat.com>

Hi Bob,

> Hi,
> 
> This all looks good and makes sense.  I am concerned
> that removing the open/close might change the behavior
> when errors occur: For example, if you try to mkfs.gfs2
> for a device you don't have permission to.  Or for a
> device that doesn't exist.  Please test those two cases
> to make sure nothing weird happens.
> 
Maybe my mistake to not have written it before, but, I've checked the 
are_you_sure() calls into the code, and before any call to are_you_sure()
we have a open/close test, so, we had the are_you_sure() doing a second
test.

Portions of code in the main_mkfs() function (almost at the begining of the function):

553         sdp->device_fd = open(sdp->device_name, O_RDWR | O_CLOEXEC);
554         if (sdp->device_fd < 0)
555                 die( _("can't open device %s: %s\n"),
556                     sdp->device_name, strerror(errno));
557
558         if (fstat(sdp->device_fd, &st_buf) < 0) {
559                 fprintf(stderr, _("could not fstat fd %d: %s\n"),
560                         sdp->device_fd, strerror(errno));
561                 exit(-1);
562         }
563 
564         if (!sdp->override)
565                 are_you_sure();
.
.
591         verify_bsize(sdp);


After that, we have a call to are_you_sure() inside the verify_bsize()
function, but, the verify_bsize() is called once, in the main_mkfs() too,
after the check specified on the code snippet above. 
What do you think? Are these 3 patches ok to push?

-- 
--Carlos



  reply	other threads:[~2011-09-27 17:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-27 16:08 [Cluster-devel] [PATCH 1/3] mkfs: Use rpmatch() to yes/no questions Carlos Maiolino
2011-09-27 16:08 ` [Cluster-devel] [PATCH 2/3] mkfs: Remove unneeded open/close fd test from are_you_sure() Carlos Maiolino
2011-09-27 16:08   ` [Cluster-devel] [PATCH 3/3] mkfs: remove duplicated code to ask yes/no question Carlos Maiolino
2011-09-27 16:35     ` Bob Peterson
2011-09-28  9:20     ` Steven Whitehouse
2011-09-27 16:37   ` [Cluster-devel] [PATCH 2/3] mkfs: Remove unneeded open/close fd test from are_you_sure() Bob Peterson
2011-09-27 17:37     ` Carlos Maiolino [this message]
2011-09-27 18:01       ` Bob Peterson
2011-09-27 16:34 ` [Cluster-devel] [PATCH 1/3] mkfs: Use rpmatch() to yes/no questions Bob Peterson
2011-09-28  9:18 ` Steven Whitehouse

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=20110927173706.GA3494@andromeda.usersys.redhat.com \
    --to=cmaiolino@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).