linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: Peilin Ye <yepeilin.cs@gmail.com>
Cc: Peilin Ye <peilin.ye@bytedance.com>,
	Cong Wang <cong.wang@bytedance.com>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] coredump: Use vmsplice_to_pipe() for pipes in dump_emit_page()
Date: Sat, 19 Nov 2022 04:46:17 +0000	[thread overview]
Message-ID: <Y3hfmYF6b5T35Xqi@ZenIV> (raw)
In-Reply-To: <20221031210349.3346-1-yepeilin.cs@gmail.com>

On Mon, Oct 31, 2022 at 02:03:49PM -0700, Peilin Ye wrote:

> +	n = vmsplice_to_pipe(file, &iter, 0);
> +	if (n == -EBADF)
> +		n = __kernel_write_iter(cprm->file, &iter, &pos);

Yuck.  If anything, I would rather put a flag into coredump_params
and check it instead; this check for -EBADF is both unidiomatic and
brittle.  Suppose someday somebody looks at vmsplice(2) and
decides that it would make sense to lift the "is it a pipe" check
into e.g. vmsplice_type().  There's no obvious reasons not to,
unless one happens to know that coredump relies upon that check done
in vmsplice_to_pipe().  It's asking for trouble several years down
the road.

Make it explicit and independent from details of error checking
in vmsplice(2).

  parent reply	other threads:[~2022-11-19  4:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-29  0:51 [PATCH v1] coredump: Use vmsplice_to_pipe() for pipes in dump_emit_page() Peilin Ye
2022-10-29  7:20 ` kernel test robot
2022-10-29  9:12 ` kernel test robot
2022-10-31 21:03 ` [PATCH v2] " Peilin Ye
2022-11-19  0:17   ` [PATCH v2 RESEND] " Peilin Ye
2022-11-19  4:46   ` Al Viro [this message]
2022-11-30  3:40     ` [PATCH v2] " Peilin Ye
2022-11-30  5:37   ` [PATCH v3] " Peilin Ye
2023-01-12 22:43     ` [PATCH v3 RESEND] " Peilin Ye

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=Y3hfmYF6b5T35Xqi@ZenIV \
    --to=viro@zeniv.linux.org.uk \
    --cc=cong.wang@bytedance.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peilin.ye@bytedance.com \
    --cc=yepeilin.cs@gmail.com \
    /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).