All of lore.kernel.org
 help / color / mirror / Atom feed
* ubifs: ubifs_purge_xattrs() wrongly called
@ 2021-01-20 13:38 Sascha Hauer
  2021-01-21  8:43 ` Richard Weinberger
  0 siblings, 1 reply; 2+ messages in thread
From: Sascha Hauer @ 2021-01-20 13:38 UTC (permalink / raw)
  To: linux-mtd; +Cc: Richard Weinberger

Hi All,

I just noticed that ubifs_purge_xattrs() is wrongly called from
ubifs_unlink() when a dentry is deleted. Deleting a dentry doesn't mean
that the inode the xattrs are attached to is going away. Removing a file
that has hardlinks will result in removing the xattrs when instead they
should stay until the last link is removed.

ubifs_purge_xattrs() only removes the xattrs when their number exceeds
ubifs_xattr_max_cnt(). Otherwise it does nothing, so it's unlikely to
hit this bug in real life.

I am not sure how to fix that. Maybe calling ubifs_purge_xattrs() from
ubifs_evict_inode() would be correct, but I haven't looked deeper into
this.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: ubifs: ubifs_purge_xattrs() wrongly called
  2021-01-20 13:38 ubifs: ubifs_purge_xattrs() wrongly called Sascha Hauer
@ 2021-01-21  8:43 ` Richard Weinberger
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Weinberger @ 2021-01-21  8:43 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: Richard Weinberger, linux-mtd

Sascha,

On Wed, Jan 20, 2021 at 2:45 PM Sascha Hauer <sha@pengutronix.de> wrote:
>
> Hi All,
>
> I just noticed that ubifs_purge_xattrs() is wrongly called from
> ubifs_unlink() when a dentry is deleted. Deleting a dentry doesn't mean
> that the inode the xattrs are attached to is going away. Removing a file
> that has hardlinks will result in removing the xattrs when instead they
> should stay until the last link is removed.

you are right, that's a bug we need to address.

> ubifs_purge_xattrs() only removes the xattrs when their number exceeds
> ubifs_xattr_max_cnt(). Otherwise it does nothing, so it's unlikely to
> hit this bug in real life.

Yes. The idea is being able to remove inodes from old filesystems
where we didn't
had the limitation.

> I am not sure how to fix that. Maybe calling ubifs_purge_xattrs() from
> ubifs_evict_inode() would be correct, but I haven't looked deeper into
> this.

I can't remember right now why I didn't use the evict path.
Hmmm.

-- 
Thanks,
//richard

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-21  8:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-20 13:38 ubifs: ubifs_purge_xattrs() wrongly called Sascha Hauer
2021-01-21  8:43 ` Richard Weinberger

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.