Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp494037pxb; Thu, 21 Jan 2021 12:03:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJwgfk4bpc9757sFHvvNGurZyRKjLPZRgdgd1ABebb9sgNk1zvzuNSUt8CXzVEcerHn6DF32 X-Received: by 2002:aa7:dd16:: with SMTP id i22mr612103edv.215.1611259410354; Thu, 21 Jan 2021 12:03:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611259410; cv=none; d=google.com; s=arc-20160816; b=EGwbciYXReRFJa9+OHGxMw69nM9mCO8+5XRW/xTa08eWJqDV1nDIPIOsVdpeIVqU3N XJechClSG2JdQ7ctF3Z65NiMIKcfA/JHPY3SJIVbTT0X7wA4iS7w6SDMrGrqErM+FyKy DE5rJPT+P2EIp8/EFA19t8po0p0EwRTOomfYe3SNsLJ40iIdI2C9hLWSDPk0EPsBWVP3 9ZrgMpzaxuSHeOeZvOUs0f4lID+ZoX3q6QpBW1qOCABV0Vl9PPZmWi1t64QaQKckTVQo aLLBAjrBkJzhdTfHZz/UXOQ58PmWbES+Slc+LzZPNNo7WSIYD+zI7NnRMCzGSYAGv8U7 /oYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=S97i6C/rmHOY7co2zGc5iztRw+fgKvtpyG/eEee82jc=; b=ZfNa02qtkY8Z1R+MLrZZfO6sMlqVnnJZjt8PG9WSYAgPx7C29mR1eeSdLtRgonWK/k L7T22rTKWV/NsSRkMsOzw5saJs1ZmFH0gkGLHK2q0IJrX+AMfE+xsAxMcLYLIMlX31PC rZP5mod+pIN4CuP6q3imbpP5D467+qK2ccrEvUaz69/NztSRltERtmd53nnvxBfRlpLR BwCaOfrQ5yzjBXI5aj+vaAIhwo1HajSsHb3PH8fr2iswebMKOk6DRs+8+WIMgpBNqUvV 5L/ySFZZ768xDfHc1DZIKlOD4Pzd3xLFGJv+2lEIzsyKaBfLL23eO7ghYic1A9AFy+pF Yq/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Aj7MqcU3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z4si668351ejr.376.2021.01.21.12.03.04; Thu, 21 Jan 2021 12:03:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Aj7MqcU3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726882AbhAUUBu (ORCPT + 99 others); Thu, 21 Jan 2021 15:01:50 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:46270 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726519AbhAUUAP (ORCPT ); Thu, 21 Jan 2021 15:00:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611259128; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=S97i6C/rmHOY7co2zGc5iztRw+fgKvtpyG/eEee82jc=; b=Aj7MqcU3X0eNxIxjId1rAUEdq4VrRQIorK/JnIybgRgs3u8sl46b9XIFoOLJf0ZEjKpzq0 QbkrRIAiBW2NQq9EkPRhjUC/OJ2awtGlK/0nhMmokzL8FTgs3WWTxYPIaAn7rDy8khcSO3 ABqb1Yx1fwPY174XcN4YziCyeOkUuhc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-420-30ztVgtON1KTodTJEFfTvA-1; Thu, 21 Jan 2021 14:58:47 -0500 X-MC-Unique: 30ztVgtON1KTodTJEFfTvA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A942B801817; Thu, 21 Jan 2021 19:58:45 +0000 (UTC) Received: from bfoster (ovpn-114-23.rdu2.redhat.com [10.10.114.23]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1F58560BF3; Thu, 21 Jan 2021 19:58:45 +0000 (UTC) Date: Thu, 21 Jan 2021 14:58:43 -0500 From: Brian Foster To: Jeffrey Mitchell Cc: "Darrick J . Wong" , linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] xfs: set inode size after creating symlink Message-ID: <20210121195843.GD1793795@bfoster> References: <20210121151912.4429-1-jeffrey.mitchell@starlab.io> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210121151912.4429-1-jeffrey.mitchell@starlab.io> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 21, 2021 at 09:19:12AM -0600, Jeffrey Mitchell wrote: > When XFS creates a new symlink, it writes its size to disk but not to the > VFS inode. This causes i_size_read() to return 0 for that symlink until > it is re-read from disk, for example when the system is rebooted. > > I found this inconsistency while protecting directories with eCryptFS. > The command "stat path/to/symlink/in/ecryptfs" will report "Size: 0" if > the symlink was created after the last reboot on an XFS root. > > Call i_size_write() in xfs_symlink() > > Signed-off-by: Jeffrey Mitchell > --- Reviewed-by: Brian Foster > fs/xfs/xfs_symlink.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/fs/xfs/xfs_symlink.c b/fs/xfs/xfs_symlink.c > index 1f43fd7f3209..c835827ae389 100644 > --- a/fs/xfs/xfs_symlink.c > +++ b/fs/xfs/xfs_symlink.c > @@ -300,6 +300,7 @@ xfs_symlink( > } > ASSERT(pathlen == 0); > } > + i_size_write(VFS_I(ip), ip->i_d.di_size); > > /* > * Create the directory entry for the symlink. > -- > 2.25.1 >