From: Ted Ts'o <tytso@mit.edu>
To: Andreas Dilger <adilger@whamcloud.com>
Cc: linux-ext4@vger.kernel.org
Subject: Re: [PATCH] ext4: avoid setting directory i_nlink to zero
Date: Wed, 26 Oct 2011 03:30:40 -0400 [thread overview]
Message-ID: <20111026073040.GM31921@thunk.org> (raw)
In-Reply-To: <1319556785-34754-1-git-send-email-adilger@whamcloud.com>
On Tue, Oct 25, 2011 at 09:33:05AM -0600, Andreas Dilger wrote:
> If a directory with more than EXT4_LINK_MAX subdirectories, the nlink
> count is set to 1. Subsequently, if any subdirectories are deleted,
> ext4_dec_count() decrements the i_nlink count, which may go to 0
> temporarily before being incremented back to 1.
>
> While this is done under i_mutex, which prevents races for directory
> and inode operations that check i_nlink, the temporary i_nlink == 0
> case is exposed to userspace via stat() and similar calls that do not
> hold i_mutex.
>
> Instead, change the code to not decrement i_nlink count for any
> directories that do not already have i_nlink larger than 2.
>
> Reported-by: Cliff White <cliffw@whamcloud.com>
> Reviewed-by: Johann Lombardi <johann@whamcloud.com>
> Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Applied, thanks.
- Ted
prev parent reply other threads:[~2011-10-26 7:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-25 15:33 [PATCH] ext4: avoid setting directory i_nlink to zero Andreas Dilger
2011-10-26 7:30 ` Ted Ts'o [this message]
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=20111026073040.GM31921@thunk.org \
--to=tytso@mit.edu \
--cc=adilger@whamcloud.com \
--cc=linux-ext4@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.