From: <cheng.lin130@zte.com.cn>
To: <djwong@kernel.org>, <brauner@kernel.org>
Cc: <viro@zeniv.linux.org.uk>, <linux-fsdevel@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <david@fromorbit.com>,
<hch@infradead.org>, <jiang.yong5@zte.com.cn>,
<wang.liang82@zte.com.cn>, <liu.dong3@zte.com.cn>
Subject: Re: [RFC PATCH] fs: introduce check for drop/inc_nlink
Date: Tue, 17 Oct 2023 10:31:23 +0800 (CST) [thread overview]
Message-ID: <202310171031234639906@zte.com.cn> (raw)
In-Reply-To: <20231017005747.GB11424@frogsfrogsfrogs>
> On Fri, Oct 13, 2023 at 05:40:57PM +0800, cheng.lin130@zte.com.cn wrote:
> > > On Fri, Oct 13, 2023 at 03:27:30PM +0800, cheng.lin130@zte.com.cn wrote:
> > > > From: Cheng Lin <cheng.lin130@zte.com.cn>
> > > >
> > > > Avoid inode nlink overflow or underflow.
> > > >
> > > > Signed-off-by: Cheng Lin <cheng.lin130@zte.com.cn>
> > > > ---
> > > I'm very confused. There's no explanation why that's needed. As it
> > > stands it's not possible to provide a useful review.
> > > I'm not saying it's wrong. I just don't understand why and even if this
> > > should please show up in the commit message.
> > In an xfs issue, there was an nlink underflow of a directory inode. There
> > is a key information in the kernel messages, that is the WARN_ON from
> > drop_nlink(). However, VFS did not prevent the underflow. I'm not sure
> > if this behavior is inadvertent or specifically designed. As an abnormal
> > situation, perhaps prohibiting nlink overflow or underflow is a better way
> > to handle it.
> > Request for your comment.
> I was trying to steer you towards modifying vfs_rmdir and vfs_unlink to
> check that i_nlink of the files involved aren't somehow already zero
> and returning -EFSCORRUPTED if they are. Not messing around with
> drop_nlink.
> --D
It seems that VFS is not very concerned about the values of filesystem,
such as inode nlinks. And the defination of whether it is correct or incorrect
is left to the specific filesystem. However, in some places do have limit
up to s_max_links. Perhaps the limit down to zero is also reasonable.
Is that right?
prev parent reply other threads:[~2023-10-17 2:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-13 7:27 [RFC PATCH] fs: introduce check for drop/inc_nlink cheng.lin130
2023-10-13 8:02 ` Christian Brauner
2023-10-13 9:40 ` cheng.lin130
2023-10-17 0:57 ` Darrick J. Wong
2023-10-17 2:31 ` cheng.lin130 [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=202310171031234639906@zte.com.cn \
--to=cheng.lin130@zte.com.cn \
--cc=brauner@kernel.org \
--cc=david@fromorbit.com \
--cc=djwong@kernel.org \
--cc=hch@infradead.org \
--cc=jiang.yong5@zte.com.cn \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liu.dong3@zte.com.cn \
--cc=viro@zeniv.linux.org.uk \
--cc=wang.liang82@zte.com.cn \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).