From: Carlos Maiolino Date: Tue, 27 Sep 2011 14:37:07 -0300 Subject: [Cluster-devel] [PATCH 2/3] mkfs: Remove unneeded open/close fd test from are_you_sure() In-Reply-To: <4b264c31-d653-4699-93ba-0a2ecb8e2848@zmail06.collab.prod.int.phx2.redhat.com> References: <1317139703-2755-2-git-send-email-cmaiolino@redhat.com> <4b264c31-d653-4699-93ba-0a2ecb8e2848@zmail06.collab.prod.int.phx2.redhat.com> Message-ID: <20110927173706.GA3494@andromeda.usersys.redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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