From: "Austin S. Hemmelgarn" <ahferroin7@gmail.com>
To: dsterba@suse.cz, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs-progs: fix fi du so it works in more cases
Date: Mon, 21 Mar 2016 13:53:22 -0400 [thread overview]
Message-ID: <56F03512.4050708@gmail.com> (raw)
In-Reply-To: <20160321174039.GB8095@twin.jikos.cz>
On 2016-03-21 13:40, David Sterba wrote:
> On Mon, Mar 21, 2016 at 08:23:11AM -0400, Austin S. Hemmelgarn wrote:
>> Currently, btrfs fi du uses open_file_or_dir(), which tries to open
>> it's argument with o_RDWR. Because of POSIX semantics, this fails for
>> non-root users when the file is read-only or is an executable that
>> is being run currently, or for all users (including root) when the
>> filesystem is read-only. THis results in a somewhat confusing 'Unknown
>> error -1' message when trying to check such files. Switch to using
>> open_file_or_dir3() with O_RDONLY passed in the flags, as this avoids
>> the limitations listed above, and we have no need to write to the files
>> anyway (and thus shouldn't be opening them writable).
>>
>> Signed-off-by: Austin S. Hemmelgarn <ahferroin7@gmail.com>
>
> Applied, thanks.
>
>> ---
>> Build and runtime tested on x86-64 with glibc.
>>
>> I intend to take the time at some point this week to audit all users of
>> open_file_or_dir() and similarly change any that don't need to write
>> to what they're opening, possibly adding a helper function to do a
>> read-only open.
>
> Thanks. I think using open_file_or_dir3(path, &dirstream, O_RDONLY) is
> ok, no need for a helper.
>
Agreed, especially since this appears to be the only place that used
open_file_or_dir() that doesn't potentially need write access.
prev parent reply other threads:[~2016-03-21 17:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-21 12:23 [PATCH] btrfs-progs: fix fi du so it works in more cases Austin S. Hemmelgarn
2016-03-21 15:05 ` Martin Volf
2016-03-21 17:40 ` David Sterba
2016-03-21 17:53 ` Austin S. Hemmelgarn [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=56F03512.4050708@gmail.com \
--to=ahferroin7@gmail.com \
--cc=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.