public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: ext4 development <linux-ext4@vger.kernel.org>
Cc: Theodore Tso <tytso@mit.edu>
Subject: blkid oddities with stale devices in the cache
Date: Fri, 20 Jun 2008 23:59:26 -0500	[thread overview]
Message-ID: <485C8AAE.5020005@redhat.com> (raw)

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

             reply	other threads:[~2008-06-21  4:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-21  4:59 Eric Sandeen [this message]
2008-07-06  4:36 ` blkid oddities with stale devices in the cache Eric Sandeen
2008-07-06 18:40   ` Theodore Tso

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=485C8AAE.5020005@redhat.com \
    --to=sandeen@redhat.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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