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() ? > > 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 ? Thanks. > rc = 0; > - if (rc) > + else if (rc) > goto err_out; > > d_info.wptr = d_info.rptr; > -- > 2.17.1 > >