From: Steven Whitehouse <swhiteho@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH] gfs2_grow: Don't try to open an empty string
Date: Tue, 13 Aug 2013 10:12:41 +0100 [thread overview]
Message-ID: <1376385161.2696.6.camel@menhir> (raw)
In-Reply-To: <5209F698.2010402@redhat.com>
Hi,
On Tue, 2013-08-13 at 10:04 +0100, Andrew Price wrote:
> On 09/08/13 10:41, Steven Whitehouse wrote:
> > Hi,
> >
> > On Thu, 2013-08-08 at 18:02 +0100, Andrew Price wrote:
> >> sdp->device_name wasn't getting set in gfs2_grow so is_gfs2() (called
> >> via check_for_gfs2()) fails to open "" and so we get an ENOENT.
> >>
> >> This fixes the open("") by setting sdp->device_name before passing it to
> >> is_pathname_mounted(), which has been updated to make it more clear
> >> which args will be modified by it.
> >>
> >> is_gfs2() and check_for_gfs2() have also been removed from libgfs2 as
> >> these were the only places they were being called and they aren't
> >> needed: superblock checking is done further along via other functions
> >> calling check_sb().
> >>
> > Definitely an improvement over what we had before, but I wonder whether
> > we can do better still. Is the fd always open before we call
> > is_pathname_mounted() I wonder? If so we should be able to just pass the
> > fd to it which reduces the possibility for races I think, and may also
> > simplify things a bit more,
>
> Well the problem here is that we don't know whether the path is a device
> or a mount point (gfs2_{grow,jadd} accept both) beforehand so any open
> before is_pathname_mounted() is called is going to be a guess.
>
It will be a guess, but at least once it is open, the object that is
referenced cannot change. We can then verify what we got and decide what
to do next with it, safe in the knowledge that nobody can change a
symlink (for example) under us and give us the wrong results later on.
> I think we probably can improve on this function in the process of
> making libgfs2 more fd-centric but it'll take a bit more work so I'll
> come back to that later and push this patch independently as it solves a
> problem that's currently holding up testing.
>
> Cheers,
> Andy
Yes, I think thats a good approach,
Steve.
prev parent reply other threads:[~2013-08-13 9:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-08 17:02 [Cluster-devel] [PATCH] gfs2_grow: Don't try to open an empty string Andrew Price
2013-08-09 9:41 ` Steven Whitehouse
2013-08-13 9:04 ` Andrew Price
2013-08-13 9:12 ` Steven Whitehouse [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=1376385161.2696.6.camel@menhir \
--to=swhiteho@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).