FAILED: patch "[PATCH] udf: Preserve link count of system files" failed to apply to 4.14-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 4.14-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-4.14.y
git checkout FETCH_HEAD
git cherry-pick -x fc8033a34a3ca7d23353e645e6dde5d364ac5f12
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 4.14.y' HEAD^..
Possible dependencies:
fc8033a34a3c ("udf: Preserve link count of system files") 382a2287bf9c ("udf: Remove pointless union in udf_inode_info") 044e2e26f214 ("udf: Avoid accessing uninitialized data on failed inode read") ab9a3a737284 ("udf: reduce leakage of blocks related to named streams") d288d95842f1 ("udf: Fix BUG on corrupted inode")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From fc8033a34a3ca7d23353e645e6dde5d364ac5f12 Mon Sep 17 00:00:00 2001
From: Jan Kara <[email protected]>
Date: Tue, 3 Jan 2023 09:56:56 +0100
Subject: [PATCH] udf: Preserve link count of system files
System files in UDF filesystem have link count 0. To not confuse VFS we fudge the link count to be 1 when reading such inodes however we forget to restore the link count of 0 when writing such inodes. Fix that.
fs/udf/inode.c +7 -2
@@ -1301,6 +1301,7 @@ static int udf_read_inode(struct inode *inode, bool hidden_inode) ret = -EIO ; goto out; } + iinfo->i_hidden = hidden_inode; iinfo->i_unique =0 ; iinfo->i_lenEAttr =0 ; iinfo->i_lenExtents =0 ;
@@ -1636,8 +1637,12 @@ static int udf_update_inode(struct inode *inode, int do_sync)if (S_ISDIR (inode->i_mode) && inode->i_nlink >0 ) fe->fileLinkCount =cpu_to_le16 (inode->i_nlink -1 ); -else - fe->fileLinkCount =cpu_to_le16 (inode->i_nlink); +else { +if (iinfo->i_hidden) + fe->fileLinkCount =cpu_to_le16 (0 ); +else + fe->fileLinkCount =cpu_to_le16 (inode->i_nlink); + } fe->informationLength =cpu_to_le64 (inode->i_size);
fs/udf/super.c +1 -0
@@ -147,6 +147,7 @@ static struct inode *udf_alloc_inode(struct super_block *sb) ei->i_next_alloc_goal =0 ; ei->i_strat4096 =0 ; ei->i_streamdir =0 ; + ei->i_hidden =0 ;init_rwsem (&ei->i_data_sem); ei->cached_extent.lstart =-1 ;spin_lock_init (&ei->i_extent_cache_lock);
fs/udf/udf_i.h +2 -1
@@ -44,7 +44,8 @@ struct udf_inode_info { unsigned i_use : 1; /* unallocSpaceEntry */ unsigned i_strat4096 : 1; unsigned i_streamdir : 1; - unsigned reserved : 25; + unsigned i_hidden : 1; /* hidden system inode */ + unsigned reserved : 24;__u8 *i_data;struct kernel_lb_addr i_locStreamdir;__u64 i_lenStreams;