2022-08-22 11:14 GMT+09:00, Hyunchul Lee <hyc.lee@xxxxxxxxx>: > 2022년 8월 22일 (월) 오전 9:51, Namjae Jeon <linkinjeon@xxxxxxxxxx>님이 작성: >> >> 2022-08-19 13:35 GMT+09:00, Hyunchul Lee <hyc.lee@xxxxxxxxx>: >> > if iterate_dir() returns non-negative value, >> > caller has to treat it as normal and >> > check there is any error while populating >> > dentry information. ksmbd doesn't have to >> > do anything because ksmbd already >> > checks too small OutputBufferLength to >> > store one file information. >> > >> > And because ctx->pos is set to file->f_pos >> > when iterative_dir is called, remove >> > restart_ctx(). >> Shouldn't we get rid of the useless restart_ctx() ? >> > > There is one place to call this function. We can > replace that with ctx->pos = 0 and remove this function. Why should we do ctx->pos = 0 there ? > >> > >> > This patch fixes some failure of >> > SMB2_QUERY_DIRECTORY, which happens when >> > ntfs3 is local filesystem. >> > >> > Signed-off-by: Hyunchul Lee <hyc.lee@xxxxxxxxx> >> > --- >> > fs/ksmbd/smb2pdu.c | 6 ++---- >> > 1 file changed, 2 insertions(+), 4 deletions(-) >> > >> > diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c >> > index 53c91ab02be2..6716c4e3c16d 100644 >> > --- a/fs/ksmbd/smb2pdu.c >> > +++ b/fs/ksmbd/smb2pdu.c >> > @@ -3970,11 +3970,9 @@ int smb2_query_dir(struct ksmbd_work *work) >> > */ >> > if (!d_info.out_buf_len && !d_info.num_entry) >> > goto no_buf_len; >> > - if (rc == 0) >> > - restart_ctx(&dir_fp->readdir_data.ctx); >> > - if (rc == -ENOSPC) >> > + if (rc > 0 || rc == -ENOSPC) >> Do you know why -ENOSPC error is ignored ? >> > > I don't know why and can't find the commit history > for this. After checking if -ENOSPC error is returned, there is no need to leave it if it is not needed. > >> Thanks. >> > rc = 0; >> > - if (rc) >> > + else if (rc) >> > goto err_out; >> > >> > d_info.wptr = d_info.rptr; >> > -- >> > 2.17.1 >> > >> > > > > > -- > Thanks, > Hyunchul >