public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
* blkid oddities with stale devices in the cache
@ 2008-06-21  4:59 Eric Sandeen
  2008-07-06  4:36 ` Eric Sandeen
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Sandeen @ 2008-06-21  4:59 UTC (permalink / raw)
  To: ext4 development; +Cc: Theodore Tso

This is w.r.t. https://bugzilla.redhat.com/show_bug.cgi?id=452333

Dave had a few stale entries in blkid.tab; label from a usb key showed
up under several non-existent, stale device names.  fstab had LABEL=,
mounting by label failed because blkid returned a stale, nonexistent device.

It seems there's a problem in blkid_verify():

        if (((probe.fd = open(dev->bid_name, O_RDONLY)) < 0) ||
            (fstat(probe.fd, &st) < 0)) {
                if (probe.fd >= 0) close(probe.fd);
                if ((errno != EPERM) && (errno != EACCES) &&
                    (errno != ENOENT)) {
                        DBG(DEBUG_PROBE,
                            printf("blkid_verify: error %s (%d) while "
                                   "opening %s\n", strerror(errno), errno,
                                   dev->bid_name));
                        blkid_free_dev(dev);
                        return NULL;
                }
                /* We don't have read permission, just return cache data. */
                DBG(DEBUG_PROBE,
                    printf("returning unverified data for %s\n",
                           dev->bid_name));
                return dev;

We find the bad/stale device in the cache, and stat it - if the device
doesn't exist, we get ENOENT.  But we return the stale data for the
nonexistent device anyway.  Eh?

http://git.kernel.org/?p=fs/ext2/e2fsprogs.git;a=commitdiff;h=8bcaaabb1a023af4852dbf0dba76249982c62e40

did this:

When a nonprivileged user uses the blkid command, we want to keep the
cached filesystem information, and opening a device file could result
in an EACCESS or ENOENT (if an intervening directory is mode 700).  We
were previously testing for EPERM, which was really the wrong error
code to be testing against.

But do we really want to do this in the case of ENOENT?  It seems like
this is going to grow a crop of missing devices in the cache, no?

Thanks,

-Eric

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: blkid oddities with stale devices in the cache
  2008-06-21  4:59 blkid oddities with stale devices in the cache Eric Sandeen
@ 2008-07-06  4:36 ` Eric Sandeen
  2008-07-06 18:40   ` Theodore Tso
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Sandeen @ 2008-07-06  4:36 UTC (permalink / raw)
  To: ext4 development; +Cc: Theodore Tso

Eric Sandeen wrote:
> This is w.r.t. https://bugzilla.redhat.com/show_bug.cgi?id=452333
> 
> Dave had a few stale entries in blkid.tab; label from a usb key showed
> up under several non-existent, stale device names.  fstab had LABEL=,
> mounting by label failed because blkid returned a stale, nonexistent device.

Ted, ping (when you're done kernel-wrangling anyway)?  Any thoughts on
this?  Returning cached data for a device when stat says ENOENT seems
very weird (and wrong).

Thanks,

-Eric

> It seems there's a problem in blkid_verify():
> 
>         if (((probe.fd = open(dev->bid_name, O_RDONLY)) < 0) ||
>             (fstat(probe.fd, &st) < 0)) {
>                 if (probe.fd >= 0) close(probe.fd);
>                 if ((errno != EPERM) && (errno != EACCES) &&
>                     (errno != ENOENT)) {
>                         DBG(DEBUG_PROBE,
>                             printf("blkid_verify: error %s (%d) while "
>                                    "opening %s\n", strerror(errno), errno,
>                                    dev->bid_name));
>                         blkid_free_dev(dev);
>                         return NULL;
>                 }
>                 /* We don't have read permission, just return cache data. */
>                 DBG(DEBUG_PROBE,
>                     printf("returning unverified data for %s\n",
>                            dev->bid_name));
>                 return dev;
> 
> We find the bad/stale device in the cache, and stat it - if the device
> doesn't exist, we get ENOENT.  But we return the stale data for the
> nonexistent device anyway.  Eh?
> 
> http://git.kernel.org/?p=fs/ext2/e2fsprogs.git;a=commitdiff;h=8bcaaabb1a023af4852dbf0dba76249982c62e40
> 
> did this:
> 
> When a nonprivileged user uses the blkid command, we want to keep the
> cached filesystem information, and opening a device file could result
> in an EACCESS or ENOENT (if an intervening directory is mode 700).  We
> were previously testing for EPERM, which was really the wrong error
> code to be testing against.
> 
> But do we really want to do this in the case of ENOENT?  It seems like
> this is going to grow a crop of missing devices in the cache, no?
> 
> Thanks,
> 
> -Eric
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: blkid oddities with stale devices in the cache
  2008-07-06  4:36 ` Eric Sandeen
@ 2008-07-06 18:40   ` Theodore Tso
  0 siblings, 0 replies; 3+ messages in thread
From: Theodore Tso @ 2008-07-06 18:40 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: ext4 development

On Sat, Jul 05, 2008 at 11:36:09PM -0500, Eric Sandeen wrote:
> Eric Sandeen wrote:
> > This is w.r.t. https://bugzilla.redhat.com/show_bug.cgi?id=452333
> > 
> > Dave had a few stale entries in blkid.tab; label from a usb key showed
> > up under several non-existent, stale device names.  fstab had LABEL=,
> > mounting by label failed because blkid returned a stale, nonexistent device.
> 
> Ted, ping (when you're done kernel-wrangling anyway)?  Any thoughts on
> this?  Returning cached data for a device when stat says ENOENT seems
> very weird (and wrong).

Check out what I just pushed out to the git repository.  I think this
should solve the problems people have been reporting....

       	     	 	  	      	   - Ted

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-07-06 18:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-21  4:59 blkid oddities with stale devices in the cache Eric Sandeen
2008-07-06  4:36 ` Eric Sandeen
2008-07-06 18:40   ` Theodore Tso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox