Re: [PATCH 03/28] unlink: monitor i_nlink

Christoph Hellwig
2006-08-03T14:35:51Z

On Tue, Aug 01, 2006 at 04:52:42PM -0700, Dave Hansen wrote:
>
> When a filesystem decrements i_nlink to zero, it means that a
> write must be performed in order to drop the inode from the
> filesystem.
>
> We're shortly going to have keep filesystems from being remounted
> r/o between the time that this i_nlink decrement and that write
> occurs.
>
> So, add a little helper function to do the decrements. We'll
> tie into it in a bit to note when i_nlink hits zero.

Looks good. I wonder if we could find a better name for it. Maybe just
dec_nlink? And add a simple counterpart

static inline void inc_nlink(struct inode *inode)
{
inode->i_nlink++;
}

for symmetry reasons. After that the patch can go off to Andrew before
the series aswell.

> Should
> we also be checking all of the places where i_nlink is explicitly
> set to 0 in the unlink paths?

They'll definitly need some auditing.