All of lore.kernel.org
 help / color / mirror / Atom feed
From: Namjae Jeon <linkinjeon@kernel.org>
To: Hyunchul Lee <hyc.lee@gmail.com>
Cc: linux-cifs <linux-cifs@vger.kernel.org>,
	Steve French <smfrench@gmail.com>,
	Sergey Senozhatsky <senozhatsky@chromium.org>
Subject: Re: [PATCH v2] ksmbd: remove unnecessary generic_fillattr in smb2_open
Date: Wed, 10 Aug 2022 16:58:09 +0900	[thread overview]
Message-ID: <CAKYAXd8vXKY2mp58zc3epFxS7Pp4AZ+ggKh0Rv-rXCLAaQAW1w@mail.gmail.com> (raw)
In-Reply-To: <20220810010446.9229-1-hyc.lee@gmail.com>

2022-08-10 10:04 GMT+09:00, Hyunchul Lee <hyc.lee@gmail.com>:
> Move the call of ksmbd_vfs_getattr above the place
> where stat is needed, and remove unnecessary
> the call of generic_fillattr.
>
> This patch fixes wrong AllocationSize of SMB2_CREATE
> response. Because ext4 updates inode->i_blocks only
> when disk space is allocated, generic_fillattr does
> not set stat.blocks properly for delayed allocation.
So what causes delay allocation between the lines you moved this code?

> But ext4 returns the blocks that include the delayed
> allocation blocks when getattr is called.
>
> Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
> ---
> Changes from v1:
>  - Update the commit description.
>
>  fs/ksmbd/smb2pdu.c | 15 ++++++---------
>  1 file changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c
> index e6f4ccc12f49..7b4bd0d81133 100644
> --- a/fs/ksmbd/smb2pdu.c
> +++ b/fs/ksmbd/smb2pdu.c
> @@ -3022,12 +3022,6 @@ int smb2_open(struct ksmbd_work *work)
>  	list_add(&fp->node, &fp->f_ci->m_fp_list);
>  	write_unlock(&fp->f_ci->m_lock);
>
> -	rc = ksmbd_vfs_getattr(&path, &stat);
> -	if (rc) {
> -		generic_fillattr(user_ns, d_inode(path.dentry), &stat);
> -		rc = 0;
> -	}
> -
>  	/* Check delete pending among previous fp before oplock break */
>  	if (ksmbd_inode_pending_delete(fp)) {
>  		rc = -EBUSY;
> @@ -3114,6 +3108,12 @@ int smb2_open(struct ksmbd_work *work)
>  		}
>  	}
>
> +	rc = ksmbd_vfs_getattr(&path, &stat);
> +	if (rc) {
> +		generic_fillattr(user_ns, d_inode(path.dentry), &stat);
> +		rc = 0;
> +	}
> +
>  	if (stat.result_mask & STATX_BTIME)
>  		fp->create_time = ksmbd_UnixTimeToNT(stat.btime);
>  	else
> @@ -3129,9 +3129,6 @@ int smb2_open(struct ksmbd_work *work)
>
>  	memcpy(fp->client_guid, conn->ClientGUID, SMB2_CLIENT_GUID_SIZE);
>
> -	generic_fillattr(user_ns, file_inode(fp->filp),
> -			 &stat);
> -
>  	rsp->StructureSize = cpu_to_le16(89);
>  	rcu_read_lock();
>  	opinfo = rcu_dereference(fp->f_opinfo);
> --
> 2.17.1
>
>

  reply	other threads:[~2022-08-10  7:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-10  1:04 [PATCH v2] ksmbd: remove unnecessary generic_fillattr in smb2_open Hyunchul Lee
2022-08-10  7:58 ` Namjae Jeon [this message]
2022-08-10  8:00   ` Namjae Jeon
2022-08-10 23:18     ` Hyunchul Lee
2022-08-11  5:32       ` Hyunchul Lee
2022-08-11  5:46         ` Namjae Jeon
2022-08-11  6:20           ` Hyunchul Lee

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=CAKYAXd8vXKY2mp58zc3epFxS7Pp4AZ+ggKh0Rv-rXCLAaQAW1w@mail.gmail.com \
    --to=linkinjeon@kernel.org \
    --cc=hyc.lee@gmail.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=senozhatsky@chromium.org \
    --cc=smfrench@gmail.com \
    /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.