namjaejeon/ksmbd

del dir err

Closed this issue · 4 comments

#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
static bool __dir_empty(struct dir_context *ctx, const char *name, int namlen,
#else
static int __dir_empty(struct dir_context *ctx, const char *name, int namlen,
#endif
		       loff_t offset, u64 ino, unsigned int d_type)
{
	struct ksmbd_readdir_data *buf;

	buf = container_of(ctx, struct ksmbd_readdir_data, ctx);
	buf->dirent_count++;

// by keming
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
		return buf->dirent_count <= 2;
#else
		return !(buf->dirent_count <= 2);
#endif
}

Why? Could you elaborate more ?

Return to 0 to continue. If there are files in the directory, the detection result is also empty. The final deletion of the directory failed, but the client thinks it has been successfully deleted

Thanks for your report:) I have applied this patch(cce5f41).

Done.