Re: [PATCH 1/2] ksmbd: replace generic_fillattr with vfs_getattr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> @@ -5460,17 +5506,24 @@ int smb2_close(struct ksmbd_work *work)
>  		}
>
>  		inode = file_inode(fp->filp);
Now that we no longer need to use inode here, We can delete it,

Thanks for your work.
> +		ret = vfs_getattr(&fp->filp->f_path, &stat, STATX_BASIC_STATS,
> +				  AT_STATX_SYNC_AS_STAT);
> +		if (ret) {
> +			ksmbd_fd_put(work, fp);
> +			goto out;
> +		}
> +
>  		rsp->Flags = SMB2_CLOSE_FLAG_POSTQUERY_ATTRIB;
> -		rsp->AllocationSize = S_ISDIR(inode->i_mode) ? 0 :
> -			cpu_to_le64(inode->i_blocks << 9);
> -		rsp->EndOfFile = cpu_to_le64(inode->i_size);
> +		rsp->AllocationSize = S_ISDIR(stat.mode) ? 0 :
> +			cpu_to_le64(stat.blocks << 9);
> +		rsp->EndOfFile = cpu_to_le64(stat.size);
>  		rsp->Attributes = fp->f_ci->m_fattr;
>  		rsp->CreationTime = cpu_to_le64(fp->create_time);
> -		time = ksmbd_UnixTimeToNT(inode_get_atime(inode));
> +		time = ksmbd_UnixTimeToNT(stat.atime);
>  		rsp->LastAccessTime = cpu_to_le64(time);
> -		time = ksmbd_UnixTimeToNT(inode_get_mtime(inode));
> +		time = ksmbd_UnixTimeToNT(stat.mtime);
>  		rsp->LastWriteTime = cpu_to_le64(time);
> -		time = ksmbd_UnixTimeToNT(inode_get_ctime(inode));
> +		time = ksmbd_UnixTimeToNT(stat.ctime);
>  		rsp->ChangeTime = cpu_to_le64(time);
>  		ksmbd_fd_put(work, fp);
>  	} else {




[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux