All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gao Xiang <hsiangkao@linux.alibaba.com>
To: Hongzhen Luo <hongzhen@linux.alibaba.com>, linux-erofs@lists.ozlabs.org
Subject: Re: [PATCH] erofs-utils: lib: add support for symlink file in erofs_ilookup()
Date: Mon, 12 Aug 2024 10:24:18 +0800	[thread overview]
Message-ID: <561ee8da-92b8-424f-ba28-bbd5614d77b7@linux.alibaba.com> (raw)
In-Reply-To: <20240811080957.2179279-1-hongzhen@linux.alibaba.com>



On 2024/8/11 16:09, Hongzhen Luo wrote:
> When the `path` contains symbolic links, erofs_ilookup() does not
> function properly. This adds support for symlink files.

Can you explain what's the use cases of this patch?

It seems both erofsfuse and fsck.erofs --extract don't need this.

> 
> Signed-off-by: Hongzhen Luo <hongzhen@linux.alibaba.com>
> ---
>   lib/namei.c | 25 ++++++++++++++++++++++++-
>   1 file changed, 24 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/namei.c b/lib/namei.c
> index 6f35ee6..dce2991 100644
> --- a/lib/namei.c
> +++ b/lib/namei.c
> @@ -195,6 +195,22 @@ struct nameidata {
>   	unsigned int	ftype;
>   };
>   
> +static int link_path_walk(const char *name, struct nameidata *nd);
> +
> +static int step_into_link(struct nameidata *nd, struct erofs_inode *vi)
> +{
> +	char buf[EROFS_MAX_BLOCK_SIZE];
> +	int err;
> +
> +	if (vi->i_size > EROFS_MAX_BLOCK_SIZE)
> +		return -EINVAL;

No, symlink size is independent to EROFS_MAX_BLOCK_SIZE, currently
it's hard-code as 4096.

> +	memset(buf, 0, sizeof(buf));
> +	err = erofs_pread(vi, buf, vi->i_size, 0);
> +	if (err)
> +		return err;
> +	return link_path_walk(buf, nd);
> +}
> +
>   int erofs_namei(struct nameidata *nd, const char *name, unsigned int len)
>   {
>   	erofs_nid_t nid = nd->nid;
> @@ -233,6 +249,11 @@ int erofs_namei(struct nameidata *nd, const char *name, unsigned int len)
>   			return PTR_ERR(de);
>   
>   		if (de) {
> +			vi.nid = de->nid;
> +			ret = erofs_read_inode_from_disk(&vi);
> +			if (S_ISLNK(vi.i_mode)) {
> +				return step_into_link(nd, &vi);
> +			}

Why need brace here?

Thanks,
Gao Xiang

  reply	other threads:[~2024-08-12  2:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-11  8:09 [PATCH] erofs-utils: lib: add support for symlink file in erofs_ilookup() Hongzhen Luo
2024-08-12  2:24 ` Gao Xiang [this message]
2024-08-12  2:50   ` Hongzhen Luo
2024-08-12  3:03     ` Gao Xiang
2024-08-12  3:14       ` Hongzhen Luo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=561ee8da-92b8-424f-ba28-bbd5614d77b7@linux.alibaba.com \
    --to=hsiangkao@linux.alibaba.com \
    --cc=hongzhen@linux.alibaba.com \
    --cc=linux-erofs@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.