Re: behavior of RO file system

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

 



On Thu, 02 Jun 2011 21:23:23 +0900
Daisuke Fujita <fuzita.daisuke@xxxxxxxxxxxxxx> wrote:

> Dear developers,
> 
> I got the "tgtadm: invalid request" message when I executed the 
> following command.
> 
> # tgtadm --lld iscsi --op new --mode logicalunit --tid=1 --lun 1 -b
> /media/CentOS_5.4_Final/RELEASE-NOTES-en.html
> tgtadm: invalid request
> # tail /var/log/messages
> Jun  2 20:52:58 cent_54_agt_fu2 tgtd: backed_file_open(92) Could not open
> /media/CentOS_5.4_Final/RELEASE-NOTES-en.html, Read-only file system
> 
> I think that "backed_file_open" method may return with EROFS in addition 
> to EACCES so tgtd should handle it. What do you think?
> 
> EROFS   pathname refers to a file on a read-only filesystem and write 
>         access was requested.
> 
> Reference:
> - bstype = rdwr (usr/bs_rdwr.c)
> static int bs_rdwr_open(struct scsi_lu *lu, char *path, int *fd, uint64_t
> *size)
> {
>       *fd = backed_file_open(path, O_RDWR|O_LARGEFILE|lu->bsoflags, size);
>         /* If we get access denied, try opening the file in readonly mode */
>       if (*fd == -1 && errno == EACCES) {
>                 *fd = backed_file_open(path,
> O_RDONLY|O_LARGEFILE|lu->bsoflags,
>                                        size);
>                 lu->attrs.readonly = 1;
>         }
>         if (*fd < 0)
>                 return *fd;
> 
>         return 0;
> }
> 
> - bstype=aio (usr/bs_aio.c)
> static int bs_aio_open(struct scsi_lu *lu, char *path, int *fd, uint64_t
> *size)
> {
>       *fd = backed_file_open(path, O_RDWR|O_LARGEFILE|O_DIRECT, size);
>         /* If we get access denied, try opening the file in readonly mode */
>       if (*fd == -1 && errno == EACCES) {
>                 *fd = backed_file_open(path, O_RDONLY|O_LARGEFILE|O_DIRECT,
>                                        size);
>                 lu->attrs.readonly = 1;
>         }
>         if (*fd < 0)
>                 return *fd;
>         return 0;
> }
> 
> When I changed the condition "if (*fd == -1 && errno == EACCES)" to 
> "if (*fd == -1 && (errno == EACCES || errno == EROFS))", it works as 
> I expected.

Thanks, the fix sounds good to me.

Can you send a patch?
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux