Re: [RFC] killing boilerplate checks in ->link/->mkdir/->rename

From: Artem Bityutskiy
Date: Mon Feb 06 2012 - 03:48:56 EST

On Fri, 2012-02-03 at 17:08 +0000, Al Viro wrote:
> On Fri, Feb 03, 2012 at 01:16:12AM +0000, Al Viro wrote:
> > * ubifs, hfsplus, jffs2 - definitely broken if you create enough
> > links. i_nlink wraparound to zero, confused inode eviction logics.
> BTW, ubifs plays funny games with i_nlink - decrements it early in
> unlink/rmdir/rename and then increments it back on failure. *If*
> we really want it that way, we need to use set_nlink() there. Frankly,
> I'd rather deal with drop_nlink() after the last possible failure
> exit... Unless there are serious reasons why that wouldn't work, that is.
> Artem?

The way code is organized is that the UBIFS journal subsystem functions
accept 'struct inode' and struct direntry' objects and write them out to
the media as they are in RAM. So before calling 'ubifs_jnl_update()' we
should have all the fields in 'struct inode' to be set correctly. Thus,
we have to drop 'i_nlink' before calling 'ubifs_jnl_update()'.

WRT dealing with 'drop_nlink()' after the last possible failure - I can
just make own partial copy of 'struct inode' and pass it to
'ubifs_jnl_update()', if there is a need. I would not like to make the
journal code more complex than it already is by adding 'i_nlink' usage

WRT 'sen_nlink()' - I can use it instead of 'drop_nlink()'/'inc_nlink()'
of course. But I do not really see why is this better. E.g.,
'drop_nlink()' additionally gives me ' WARN_ON()' in case of 'i_nlink'

Best Regards,
Artem Bityutskiy

Attachment: signature.asc
Description: This is a digitally signed message part