From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C219230BE9 for ; Sat, 15 Aug 2026 05:18:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786771106; cv=none; b=FLa+KJMXf0CKfH/YNAuICinyEerB+JSoHRAj51cPFMP1++uNrODQAi5FXU2Gf0MI14MAuASvtmSqi2fsD+LKjRABjaeNjD9VFavVVipLYe6dFry9ALAMq1LnOqlXsibTN1KU4ZpfQd39OUvX5vRaeNCV/d9wEE8QIxbIl4dI/Fs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786771106; c=relaxed/simple; bh=RdAMvE/g7NQ2Z7fL9W8P+5CWlu+gVObudG6ZGbeyHjI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Dj/rqFoH8f/GVy2or+zD6hGPrrVQAZw/ykLnUS4FPGhU8mJWg2WHXXRKYK+tV41WPtpgFlyXN1xBGhFAaWeicz9lz7k541pVnhIPnTxQWTGAydUjv3IzGz843sC6bhFf/Bv8Yh+Le9hokfhG27WnwpQv9/080fms/ENnW/DRWa8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=YFDqCFCZ; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="YFDqCFCZ" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=6Wj8F+XMiZI2N6GRMpnpH5FloVq8sMifI2CGpvpLA9I=; b=YFDqCFCZxhcUqItPGIIKnAFrf7 ssCmVfOUP5du0NM61Xp5qaFTKmX2OqJiZecyAeC7OUbXQLsXATcI4dZ/BFZ3Xb68paw6mmuZQRFC0 9ARW+S0CfevPArR/G86h1tTncp7JM/TuRpLRe8T0klV8KKeK/b84PUsNWCr87cQpaWjLClsRWwUTC Mtgx2EocqmT3duJ+leIBq9D1c5dzH4EITP2HeSLnhtNQbOXpHjfdzj7lzkv7baDYhpk7v16JkkVFQ mD+xKWekUYHqlA8L8XTbEKX5hN8FuMwlxz0srq+0SREcj9s47Fn0j9JotTSX/GCVysv+jmK27RkYG CQmrq/RQ==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.99.4 #2 (Red Hat Linux)) id 1wv6mi-000000034PS-2ooo; Sat, 15 Aug 2026 05:18:21 +0000 Date: Sat, 15 Aug 2026 06:18:20 +0100 From: Al Viro To: Wenjie Qi Cc: jaegeuk@kernel.org, chao@kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, stable@kernel.org, qiwenjie@xiaomi.com Subject: Re: [PATCH v2] f2fs: return symlink writeback errors Message-ID: <20260815051820.GA660827@ZenIV> References: <20260810133832.3530016-1-qiwenjie@xiaomi.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260810133832.3530016-1-qiwenjie@xiaomi.com> Sender: Al Viro On Mon, Aug 10, 2026 at 09:38:32PM +0800, Wenjie Qi wrote: > F2FS writes long symlink data with page_symlink() and then flushes the > symlink mapping to reduce the chance of exposing a broken symlink. > > That flush result is currently ignored. If the writeback fails, symlink() > still returns success even though the symlink is not durable and the same > operation can already surface -EIO through syncfs(). > > Return the writeback error to userspace and skip the dirsync flush once the > symlink data flush has failed. > if (!err) { > - filemap_write_and_wait_range(inode->i_mapping, 0, > - disk_link.len - 1); > + err = filemap_write_and_wait_range(inode->i_mapping, 0, > + disk_link.len - 1); > > - if (IS_DIRSYNC(dir)) > + if (!err && IS_DIRSYNC(dir)) > f2fs_sync_fs(sbi->sb, 1); > - } else { > - f2fs_unlink(dir, dentry); > } > > + if (err) > + f2fs_unlink(dir, dentry); That looks fishy. At that point you already have dentry hashed and AFAICS f2fs_unlink() will leave it hashed and attached to the same inode; sure, memory pressure will eventually evict the sucker, but until that point any lookups will simply pick it from dcache. It's not introduced by this patch; the same issue, AFAICS, already exists in mainline. Why do we even bother with d_instantiate_new() before we know that everything's fine, nevermind doing that when we already know the operation has failed? Incidentally, is there any reason to add a directory entry before the inode is set up? Usually that's the last step, and cleanup tends to be simpler that way; are there f2fs-specific reasons to do it in the unusual order?