linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: Olaf Hering <olaf@aepfle.de>
Cc: Deepa Dinamani <deepa.kernel@gmail.com>,
	Jeff Layton <jlayton@kernel.org>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>
Subject: Re: [PATCH v1] mount: handle OOM on mnt_warn_timestamp_expiry
Date: Tue, 30 Jul 2024 21:45:29 +0100	[thread overview]
Message-ID: <20240730204529.GG5334@ZenIV> (raw)
In-Reply-To: <20240730215827.77b90c8a.olaf@aepfle.de>

On Tue, Jul 30, 2024 at 09:58:27PM +0200, Olaf Hering wrote:
> Tue, 30 Jul 2024 16:49:24 +0100 Al Viro <viro@zeniv.linux.org.uk>:
> 
> > d_path() is *NOT* going to return NULL.
> 
> The existing documentation does not state that fact.

Needs to be fixed, but as a general rule - mixing NULL and ERR_PTR()
for error reporting is a Very Bad Idea(tm).  There are cases when
there's a legitimate reason for a function to return both, but they
are rare and NULL should not be an error case.  Example: d_splice_alias();
ERR_PTR(-E...) => error; NULL => success, passed candidate had been
accepted and attached to inode; pointer to struct dentry instance
=> success, preexisting alias returned and should be used instead
of the candidate.

Using IS_ERR_OR_NULL for "future-proofing" is obfuscating the things
for no good reason - it confuses the readers, and it tends to spread
when people are copying the code around.

Please, don't do it.

      reply	other threads:[~2024-07-30 20:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-30  8:58 [PATCH v1] mount: handle OOM on mnt_warn_timestamp_expiry Olaf Hering
2024-07-30  9:49 ` Christian Brauner
2024-07-30 13:11   ` Jan Kara
2024-07-30 15:49 ` Al Viro
2024-07-30 19:58   ` Olaf Hering
2024-07-30 20:45     ` Al Viro [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=20240730204529.GG5334@ZenIV \
    --to=viro@zeniv.linux.org.uk \
    --cc=brauner@kernel.org \
    --cc=deepa.kernel@gmail.com \
    --cc=jack@suse.cz \
    --cc=jlayton@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=olaf@aepfle.de \
    /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).