Re: [PATCH][RFC] dm: Do not open log and cow device read-write for read-only mappings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

On Tue, Feb 15, 2011 at 12:46:29PM +0000, Alasdair G Kergon wrote:
> On Tue, Feb 15, 2011 at 01:17:56PM +0100, Milan Broz wrote:
> >         fd = open(device, O_RDWR | flags);
> >         if (fd == -1 && errno == EROFS) {
> >                 *readonly = 1;
> >                 fd = open(device, O_RDONLY | flags);
> >         }
> 
> Would it be reasonable for your patch to return EROFS rather than
> EACCES?
> 
> man 2 open:
>        int open(const char *pathname, int flags, mode_t mode);
> 
>        EROFS  pathname  refers  to a file on a read-only file system and write
>               access was requested.
> 
>        EACCES The requested access to the file is not allowed, or search  perâ
>               mission  is denied for one of the directories in the path prefix
>               of pathname, or the file did not exist yet and write  access  to
>               the  parent  directory  is  not allowed.  (See also path_resoluâ
>               tion(7).)

Hmmm... but -EACCES is the correct one here.  The device node itself
is rejecting RW access.  There's no FS which is enforcing RO.  But if
the userland is already expecting that, dm can simply change the error
code, no?

Thanks.

-- 
tejun

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel



[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux