mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ian Bridges <icb@fastmail.org>
To: linkinjeon@kernel.org
Cc: senozhatsky@chromium.org, tom@talpey.com,
	chenxiaosong@chenxiaosong.com, linux-cifs@vger.kernel.org,
	linux-kernel@vger.kernel.org, Ian Bridges <icb@fastmail.org>
Subject: Re: [PATCH v2] ksmbd: return the cause of a failed link
Date: Sun, 29 Nov 2026 08:42:41 -0600	[thread overview]
Message-ID: <20261129144241.1922573-1-icb@fastmail.org> (raw)
In-Reply-To: <CAKYAXd_Fos0EggdBag1Mzz+sn=WBXNRUNT__fRUExfMrB4ivSQ@mail.gmail.com>

Hi Namjae,

Thanks for the review. Please drop this patch. I'm moving the work to
my backlog, for two reasons.

The patch does not fix a bug. A link that should fail already fails,
and only the status is less exact than it could be. And your comments
showed me that a correct change is a bigger job than I expected.

The core problem is that one errno often has more than one meaning by
the time it reaches the handler. Your -EXDEV comment is one case. The
lookup returns it for a name that leaves the share, and the link code
returns it for a different mount. The FUSE case is another. vfs_link()
returns -EPERM for an immutable file and also for a filesystem that
refuses hard links, and the i_op check only finds some of the second
kind. A shared map in the handler cannot tell these apart. Each one
needs a special case next to the map, and v2 was already collecting
them.

I tried a version that solves this at the source. Each helper in vfs.c
returns errnos that have one meaning each. Where the VFS itself gives
one errno for two causes, the helper looks at the state after the
failure to find the cause, without reading i_op. Results that are
ksmbd's own decisions set the status where they are decided. Each
handler then ends with the shared map and no special cases.

That gave the right statuses for link in my tests. But it does not
work as a small change. The lookup helpers are shared, so cleaning up
their errnos changes the statuses of smb2_open() and other handlers at
the same time. Some of those handlers also depend on the old values.
To be correct, every handler has to be converted and tested together.
That is a series of its own, and it should not ride on a patch that
fixes no bug.

I'll come back to it once the fixes I have queued are out.

Thanks,
Ian

      reply	other threads:[~2026-11-29 14:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-28 15:18 Ian Bridges
2026-11-29  2:03 ` Namjae Jeon
2026-11-29 14:42   ` Ian Bridges [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=20261129144241.1922573-1-icb@fastmail.org \
    --to=icb@fastmail.org \
    --cc=chenxiaosong@chenxiaosong.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=senozhatsky@chromium.org \
    --cc=tom@talpey.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

all inboxes | Powered by JetHome®