[PATCH 2/6] smb/server: fix return value of smb2_notify()

chenxiaosong.chenxiaosong@linux.dev posted 6 patches 3 months, 3 weeks ago
There is a newer version of this series
[PATCH 2/6] smb/server: fix return value of smb2_notify()
Posted by chenxiaosong.chenxiaosong@linux.dev 3 months, 3 weeks ago
From: ChenXiaoSong <chenxiaosong@kylinos.cn>

smb2_notify() should return error code when an error occurs,
__process_request() will print the error messages.

I may implement the SMB2 CHANGE_NOTIFY response (see MS-SMB2 2.2.36)
in the future.

Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
---
 fs/smb/server/smb2pdu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
index 83d8a325b9ea..c040df0a2073 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -8787,7 +8787,7 @@ int smb2_oplock_break(struct ksmbd_work *work)
  * smb2_notify() - handler for smb2 notify request
  * @work:   smb work containing notify command buffer
  *
- * Return:      0
+ * Return:      0 on success, otherwise error
  */
 int smb2_notify(struct ksmbd_work *work)
 {
@@ -8801,12 +8801,12 @@ int smb2_notify(struct ksmbd_work *work)
 	if (work->next_smb2_rcv_hdr_off && req->hdr.NextCommand) {
 		rsp->hdr.Status = STATUS_INTERNAL_ERROR;
 		smb2_set_err_rsp(work);
-		return 0;
+		return -EIO;
 	}
 
 	smb2_set_err_rsp(work);
 	rsp->hdr.Status = STATUS_NOT_IMPLEMENTED;
-	return 0;
+	return -EOPNOTSUPP,;
 }
 
 /**
-- 
2.43.0
Re: [PATCH 2/6] smb/server: fix return value of smb2_notify()
Posted by Namjae Jeon 3 months, 1 week ago
On Fri, Oct 17, 2025 at 5:47 PM <chenxiaosong.chenxiaosong@linux.dev> wrote:
>
> From: ChenXiaoSong <chenxiaosong@kylinos.cn>
>
> smb2_notify() should return error code when an error occurs,
> __process_request() will print the error messages.
>
> I may implement the SMB2 CHANGE_NOTIFY response (see MS-SMB2 2.2.36)
> in the future.
Do you have any plans to implement SMB2 CHANGE_NOTIFY?
Thanks.
Re: [PATCH 2/6] smb/server: fix return value of smb2_notify()
Posted by ChenXiaoSong 3 months, 1 week ago
Hi Namjae,

I’m referring to the userspace samba code and trying to implement this 
feature.

Thanks,
ChenXiaoSong.

On 11/1/25 7:56 AM, Namjae Jeon wrote:
> On Fri, Oct 17, 2025 at 5:47 PM <chenxiaosong.chenxiaosong@linux.dev> wrote:
>>
>> From: ChenXiaoSong <chenxiaosong@kylinos.cn>
>>
>> smb2_notify() should return error code when an error occurs,
>> __process_request() will print the error messages.
>>
>> I may implement the SMB2 CHANGE_NOTIFY response (see MS-SMB2 2.2.36)
>> in the future.
> Do you have any plans to implement SMB2 CHANGE_NOTIFY?
> Thanks.

Re: [PATCH 2/6] smb/server: fix return value of smb2_notify()
Posted by Namjae Jeon 3 months, 1 week ago
On Sat, Nov 1, 2025 at 9:05 AM ChenXiaoSong
<chenxiaosong.chenxiaosong@linux.dev> wrote:
>
> Hi Namjae,
Hi ChenXiaoSong,
>
> I’m referring to the userspace samba code and trying to implement this
> feature.
Sounds great!
There are requests from users to implement it :
https://github.com/namjaejeon/ksmbd/issues/495#issuecomment-3473472265
Thanks!
>
> Thanks,
> ChenXiaoSong.
>
> On 11/1/25 7:56 AM, Namjae Jeon wrote:
> > On Fri, Oct 17, 2025 at 5:47 PM <chenxiaosong.chenxiaosong@linux.dev> wrote:
> >>
> >> From: ChenXiaoSong <chenxiaosong@kylinos.cn>
> >>
> >> smb2_notify() should return error code when an error occurs,
> >> __process_request() will print the error messages.
> >>
> >> I may implement the SMB2 CHANGE_NOTIFY response (see MS-SMB2 2.2.36)
> >> in the future.
> > Do you have any plans to implement SMB2 CHANGE_NOTIFY?
> > Thanks.
>
Re: [PATCH 2/6] smb/server: fix return value of smb2_notify()
Posted by ChenXiaoSong 3 months, 1 week ago
After I finish the other patchset, I'll fully focus on developing this 
feature.

Thanks,
ChenXiaoSong.

On 11/1/25 8:10 AM, Namjae Jeon wrote:
> On Sat, Nov 1, 2025 at 9:05 AM ChenXiaoSong
> <chenxiaosong.chenxiaosong@linux.dev> wrote:
>>
>> Hi Namjae,
> Hi ChenXiaoSong,
>>
>> I’m referring to the userspace samba code and trying to implement this
>> feature.
> Sounds great!
> There are requests from users to implement it :
> https://github.com/namjaejeon/ksmbd/issues/495#issuecomment-3473472265
> Thanks!
>>
>> Thanks,
>> ChenXiaoSong.
>>
>> On 11/1/25 7:56 AM, Namjae Jeon wrote:
>>> On Fri, Oct 17, 2025 at 5:47 PM <chenxiaosong.chenxiaosong@linux.dev> wrote:
>>>>
>>>> From: ChenXiaoSong <chenxiaosong@kylinos.cn>
>>>>
>>>> smb2_notify() should return error code when an error occurs,
>>>> __process_request() will print the error messages.
>>>>
>>>> I may implement the SMB2 CHANGE_NOTIFY response (see MS-SMB2 2.2.36)
>>>> in the future.
>>> Do you have any plans to implement SMB2 CHANGE_NOTIFY?
>>> Thanks.
>>