Re: [PATCH] ksmbd: return the cause of a failed link

From: Namjae Jeon

Date: Fri Nov 27 2026 - 21:28:17 EST


> @@ -8967,8 +8965,6 @@ static int smb2_create_link(struct ksmbd_work *work,
> goto out;
> }
> rc = ksmbd_vfs_link(work, target_name, link_name);
> - if (rc)
> - rc = -EINVAL;
When smb2_create_link() passes through errors from the backing
filesystem, smb2_set_info() needs to map them to the appropriate
NTSTATUS values for FileLinkInformation. For example, vfs_link()
returns -EPERM when the filesystem has no ->link operation, as on
exFAT. With this patch, ksmbd returns STATUS_ACCESS_DENIED. The
expected status is STATUS_NOT_SUPPORTED. Also, -EMLINK should map to
STATUS_TOO_MANY_LINKS. We should check the NTSTATUS mappings for the
other errors this patch propagates as well...

Thanks.
> out:
>
> if (!IS_ERR(link_name))
>
> base-commit: 4543a3349127baa8395397b7f4aa930d9a4f8dd5
> --
> 2.47.3
>