Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2150541iof; Tue, 7 Jun 2022 21:26:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfxDIRz5q+DUot7K1x5Xgh56Sb/l+CEv2jR+Gbs8viYvlToecK5AYehTw5vfO2bfuRG8jC X-Received: by 2002:a17:902:6bc6:b0:166:3c39:50a1 with SMTP id m6-20020a1709026bc600b001663c3950a1mr31820099plt.36.1654662379794; Tue, 07 Jun 2022 21:26:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654662379; cv=none; d=google.com; s=arc-20160816; b=LGWxG/y7SbuDy2bXrbl2IbLIzKA5wpRc++DfSJnkx/2P9rYU4o0ONOT4lG+S+riLyc gmB2VWkqqoqXMlB8SZvL4pT9zJdVoeju3BMjpUDsOW3EV/rPmm/5YSDvZ+fUZCdjCVXv aaEKiaxBZ7K7O2HNNyWUnNqL3zIxGy6hVsmszHBDZyRsqqT4dFvSYQAmG0f2zHMB4tys nyQOJSqeX7jBJLv0Gw1eWLlk9ibm7gDoZ/aj0rrB2QmBw/RI8oYQdl8EFFkwJMZwk9WY +sq+uUwsOIwodL0vYAhHudp5VGfy05Ns25U0cai+e/78iDLyeTDeZerx04hvqi8yhTJD O7yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HcP5lHHZZoZM/D13avIjyWvQPGv9yjqnqa9erbljpOc=; b=UzSASD+GsdC4Fc3BQ6RFMYN28kgs7Sr2jzmdVPIJiz7oaTaqQIDWGmGscBX0/fQeAP bC5lDGCRznkbSopZdFAobId3lwTXJr3ReozaRcoxCch4TmGt6XvTEpIQZhdkXifRuJUJ 0YiH1IfRCYFDwUvx4HuoPVPeDJ/Ekz79NKCLEzxoaFJTQD8fres8i5Ptd8U6Xaf6q0A5 ABKy8H+OTaqbwuk4q/Xrj++2SN4dnABk89tjtTL+gmZOdyD00SiZrgL9q0+Bh+vRYRD9 wE4eMewNE0WqvrdOSYth3dq8lttvVYVu8dnaa1ZG3i1JnS7ecWMD/0f5jKM9ozrWOOmb X/Ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=imLsQ7q6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id o2-20020a656a42000000b003f5cfa3bbfdsi34554750pgu.233.2022.06.07.21.26.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 21:26:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=imLsQ7q6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 96BAA35687E; Tue, 7 Jun 2022 20:57:54 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349941AbiFGSKI (ORCPT + 99 others); Tue, 7 Jun 2022 14:10:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349131AbiFGRud (ORCPT ); Tue, 7 Jun 2022 13:50:33 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D4FA13AF13; Tue, 7 Jun 2022 10:37:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C15BEB820C3; Tue, 7 Jun 2022 17:37:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 290CBC34119; Tue, 7 Jun 2022 17:37:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654623469; bh=OqZ1fM3XT7xiCBk1pwig0hnNmi/cqv4tqNiVLsVyCeY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=imLsQ7q6b/R+FiHpbDkJpe3RObs7lMMBOcLXmWRc1egr3d4QXfky/ZNsJQb4GInR3 ZdFC3o154oWIgwmMUGycHCQnPdePPOYxsQfxBUiFZYQkYiqkaZ0DnfLM7I5U3q+qYp x673Og6/80RYJbc77UOPJ1EOizN6huHkZYlMgQFQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeffrey Mitchell , "Darrick J. Wong" , Christoph Hellwig , Brian Foster , Amir Goldstein Subject: [PATCH 5.10 430/452] xfs: set inode size after creating symlink Date: Tue, 7 Jun 2022 19:04:47 +0200 Message-Id: <20220607164921.367417409@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607164908.521895282@linuxfoundation.org> References: <20220607164908.521895282@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jeffrey Mitchell commit 8aa921a95335d0a8c8e2be35a44467e7c91ec3e4 upstream. 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: Darrick J. Wong Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Reviewed-by: Brian Foster Signed-off-by: Amir Goldstein Signed-off-by: Greg Kroah-Hartman --- fs/xfs/xfs_symlink.c | 1 + 1 file changed, 1 insertion(+) --- 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.