From: David Chinner <dgc@sgi.com>
To: linux-xfs@oss.sgi.com
Subject: Re: [UNSURE] can't remove dir
Date: Fri, 14 Sep 2007 19:10:32 +1000 [thread overview]
Message-ID: <20070914091032.GE734179@sgi.com> (raw)
In-Reply-To: <20070914084125.GA31074@apartia.fr>
On Fri, Sep 14, 2007 at 10:41:25AM +0200, Louis-David Mitterrand wrote:
> On Fri, Sep 14, 2007 at 04:38:22AM -0400, Justin Piszcz wrote:
> >
> > On Fri, 14 Sep 2007, Louis-David Mitterrand wrote:
> >>
> >> While cleaning up /lost+found a directory resisted removal:
> >>
> >> sylla:/lost+found# rm 1879629858 -rf
> >> rm: cannot remove directory `1879629858': Directory not empty
> >>
> >> The directory _is_ empty and "-rf" should remove it anyway, so this
> >> looks like a fs error.
> >>
> >> This is on debian unstable with 2.6.23-rc6.
> >
> > what does "ls -al 1879629858" say?
> >
>
> I knew someone would ask, and this is slightly insulting ;-)
Well, feel insulted if you want, but it was *exactly* the
right question to ask. :/
Looking at the link count of the directory that can't be removed:
> sylla:/lost+found# ls -al 1879629858
> total 24
> drwxr-xr-x 2 root root 8192 2007-09-14 09:25 ./
Which is correct for an empty directory. So this code in xfs_rmdir:
ASSERT(cdp->i_d.di_nlink >= 2);
if (cdp->i_d.di_nlink != 2) {
error = XFS_ERROR(ENOTEMPTY);
goto error_return;
}
is not where the error is coming from.
But, the size indicates that the dirctory is not in shortform
state. An empty directory should look like:
# mkdir empty
# ls -la empty
total 0
drwxrwxr-x 2 root root 6 Sep 14 18:58 ./
^^
drwxrwxr-x 4 root root 28 Sep 14 18:58 ../
#
So that means the error came from:
if (!xfs_dir_isempty(cdp)) {
error = XFS_ERROR(ENOTEMPTY);
goto error_return;
}
xfs_dir_isempty(
xfs_inode_t *dp)
{
xfs_dir2_sf_t *sfp;
ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR);
if (dp->i_d.di_size == 0) /* might happen during shutdown. */
return 1;
>>>>>>> if (dp->i_d.di_size > XFS_IFORK_DSIZE(dp))
>>>>>>> return 0;
sfp = (xfs_dir2_sf_t *)dp->i_df.if_u1.if_data;
return !sfp->hdr.count;
}
So, this wasn't a stupid question at all. It indicates that the
source of the problem is a directory that did not get converted
back to short form as the entries were removed and greatly narrows
down teh possible causes of the problem.
Can you tell us the output of 'xfs_info <mntpt>'?
Also, get the inode number of the bad directory (ls -i) and then
run:
# xfs_db -r -c "inode <inode_num>" -c "p" <device of fs>
So we can see what the state of the inode is?
BTW, what problem led you to running xfs_repair in the first
place (i.e. what led to lost+found getting populated)?
Cheers,
Dave.
--
Dave Chinner
Principal Engineer
SGI Australian Software Group
next prev parent reply other threads:[~2007-09-14 9:10 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-14 8:09 can't remove dir Louis-David Mitterrand
2007-09-14 8:38 ` [UNSURE] " Justin Piszcz
2007-09-14 8:41 ` Louis-David Mitterrand
2007-09-14 8:45 ` Justin Piszcz
2007-09-14 9:10 ` David Chinner [this message]
2007-09-14 9:27 ` Louis-David Mitterrand
2007-09-16 22:32 ` David Chinner
2007-09-18 2:43 ` Barry Naujok
2007-09-14 14:14 ` Eric Sandeen
2007-09-14 14:18 ` Eric Sandeen
2007-10-17 16:15 ` Louis-David Mitterrand
2007-10-17 16:18 ` Justin Piszcz
2007-10-17 16:30 ` Louis-David Mitterrand
2007-10-17 21:24 ` David Chinner
2007-10-18 13:11 ` Louis-David Mitterrand
2007-10-18 22:07 ` David Chinner
2007-10-19 10:10 ` Louis-David Mitterrand
2007-10-21 23:50 ` David Chinner
2007-10-22 0:42 ` Barry Naujok
2007-10-22 1:17 ` David Chinner
2007-10-22 7:04 ` Louis-David Mitterrand
2007-10-18 1:37 ` Barry Naujok
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=20070914091032.GE734179@sgi.com \
--to=dgc@sgi.com \
--cc=linux-xfs@oss.sgi.com \
/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