[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20111026073040.GM31921@thunk.org>
Date: Wed, 26 Oct 2011 03:30:40 -0400
From: Ted Ts'o <tytso@....edu>
To: Andreas Dilger <adilger@...mcloud.com>
Cc: linux-ext4@...r.kernel.org
Subject: Re: [PATCH] ext4: avoid setting directory i_nlink to zero
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@...mcloud.com>
> Reviewed-by: Johann Lombardi <johann@...mcloud.com>
> Signed-off-by: Andreas Dilger <adilger@...mcloud.com>
Applied, thanks.
- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists