public inbox for ecryptfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Tyler Hicks <code@tyhicks.com>
To: Christoph Hellwig <hch@lst.de>
Cc: ecryptfs@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 2/7] ecryptfs: cleanup ecryptfs_setattr
Date: Mon, 6 Apr 2026 00:52:40 -0500	[thread overview]
Message-ID: <adNKKJRNtyhAW6Kx@yaupon> (raw)
In-Reply-To: <20260331153752.4049454-3-hch@lst.de>

On 2026-03-31 17:37:23, Christoph Hellwig wrote:
> Initialize variables at declaration time where applicable and reformat
> conditionals to match the kernel coding style.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

This one looks good to me.

Tyler

> ---
>  fs/ecryptfs/inode.c | 22 ++++++++++------------
>  1 file changed, 10 insertions(+), 12 deletions(-)
> 
> diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
> index cf20873a9cc4..46dc867a8860 100644
> --- a/fs/ecryptfs/inode.c
> +++ b/fs/ecryptfs/inode.c
> @@ -891,25 +891,23 @@ ecryptfs_permission(struct mnt_idmap *idmap, struct inode *inode,
>  static int ecryptfs_setattr(struct mnt_idmap *idmap,
>  			    struct dentry *dentry, struct iattr *ia)
>  {
> -	int rc = 0;
> -	struct dentry *lower_dentry;
> +	struct inode *inode = d_inode(dentry);
> +	struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry);
> +	struct inode *lower_inode = ecryptfs_inode_to_lower(inode);
>  	struct iattr lower_ia;
> -	struct inode *inode;
> -	struct inode *lower_inode;
>  	struct ecryptfs_crypt_stat *crypt_stat;
> +	int rc;
>  
>  	crypt_stat = &ecryptfs_inode_to_private(d_inode(dentry))->crypt_stat;
>  	if (!(crypt_stat->flags & ECRYPTFS_STRUCT_INITIALIZED))
>  		ecryptfs_init_crypt_stat(crypt_stat);
> -	inode = d_inode(dentry);
> -	lower_inode = ecryptfs_inode_to_lower(inode);
> -	lower_dentry = ecryptfs_dentry_to_lower(dentry);
> +
>  	mutex_lock(&crypt_stat->cs_mutex);
>  	if (d_is_dir(dentry))
>  		crypt_stat->flags &= ~(ECRYPTFS_ENCRYPTED);
> -	else if (d_is_reg(dentry)
> -		 && (!(crypt_stat->flags & ECRYPTFS_POLICY_APPLIED)
> -		     || !(crypt_stat->flags & ECRYPTFS_KEY_VALID))) {
> +	else if (d_is_reg(dentry) &&
> +		 (!(crypt_stat->flags & ECRYPTFS_POLICY_APPLIED) ||
> +		  !(crypt_stat->flags & ECRYPTFS_KEY_VALID))) {
>  		struct ecryptfs_mount_crypt_stat *mount_crypt_stat;
>  
>  		mount_crypt_stat = &ecryptfs_superblock_to_private(
> @@ -922,8 +920,8 @@ static int ecryptfs_setattr(struct mnt_idmap *idmap,
>  		rc = ecryptfs_read_metadata(dentry);
>  		ecryptfs_put_lower_file(inode);
>  		if (rc) {
> -			if (!(mount_crypt_stat->flags
> -			      & ECRYPTFS_PLAINTEXT_PASSTHROUGH_ENABLED)) {
> +			if (!(mount_crypt_stat->flags &
> +			      ECRYPTFS_PLAINTEXT_PASSTHROUGH_ENABLED)) {
>  				rc = -EIO;
>  				printk(KERN_WARNING "Either the lower file "
>  				       "is not in a valid eCryptfs format, "
> -- 
> 2.47.3
> 

  reply	other threads:[~2026-04-06  5:52 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-31 15:37 cleanup truncate handling in ecryptfs Christoph Hellwig
2026-03-31 15:37 ` [PATCH 1/7] ecryptfs: streamline truncate_upper Christoph Hellwig
2026-04-06  5:52   ` Tyler Hicks
2026-04-06  6:28     ` Christoph Hellwig
2026-03-31 15:37 ` [PATCH 2/7] ecryptfs: cleanup ecryptfs_setattr Christoph Hellwig
2026-04-06  5:52   ` Tyler Hicks [this message]
2026-03-31 15:37 ` [PATCH 3/7] ecryptfs: use ZERO_PAGE instead of allocating zeroed memory in truncate_upper Christoph Hellwig
2026-04-06  5:52   ` Tyler Hicks
2026-03-31 15:37 ` [PATCH 4/7] ecryptfs: combine the two ATTR_SIZE blocks in ecryptfs_setattr Christoph Hellwig
2026-04-06  5:53   ` Tyler Hicks
2026-03-31 15:37 ` [PATCH 5/7] ecryptfs: sanitize struct iattr handling in truncate_upper Christoph Hellwig
2026-04-06  5:58   ` Tyler Hicks
2026-04-06  6:22     ` Tyler Hicks
2026-04-06  6:27       ` Christoph Hellwig
2026-04-06  6:59         ` Tyler Hicks
2026-03-31 15:37 ` [PATCH 6/7] ecryptfs: merge ecryptfs_inode_newsize_ok into truncate_upper Christoph Hellwig
2026-04-06  6:09   ` Tyler Hicks
2026-03-31 15:37 ` [PATCH 7/7] ecryptfs: call notify_change from truncate_upper Christoph Hellwig
2026-04-06  6:52   ` Tyler Hicks
  -- strict thread matches above, loose matches on Subject: below --
2026-04-07 14:02 cleanup truncate handling in ecryptfs v2 Christoph Hellwig
2026-04-07 14:02 ` [PATCH 2/7] ecryptfs: cleanup ecryptfs_setattr Christoph Hellwig

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=adNKKJRNtyhAW6Kx@yaupon \
    --to=code@tyhicks.com \
    --cc=ecryptfs@vger.kernel.org \
    --cc=hch@lst.de \
    --cc=linux-fsdevel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox