mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Baolin Liu <liubaolin12138@163.com>
To: linkinjeon@kernel.org, hyc.lee@gmail.com
Cc: ntfs@lists.linux.dev, linux-kernel@vger.kernel.org,
	chenxiaosong@chenxiaosong.com, Baolin Liu <liubaolin@kylinos.cn>
Subject: [PATCH v4 03/10] ntfs: propagate EA write and truncate errors
Date: Wed, 23 Sep 2026 14:02:39 +0800	[thread overview]
Message-ID: <20260923060246.2499192-4-liubaolin12138@163.com> (raw)
In-Reply-To: <20260923060246.2499192-1-liubaolin12138@163.com>

From: Baolin Liu <liubaolin@kylinos.cn>

ntfs_write_ea() replaces negative write errors with EIO and ignores
errors when shrinking the attribute after writing a shorter list. This
can report success even though the final resize failed.

Preserve negative write errors, use EIO for short writes, and return
truncate failures to the caller.

Signed-off-by: Baolin Liu <liubaolin@kylinos.cn>
Reviewed-by: Hyunchul Lee <hyc.lee@gmail.com>
---
 fs/ntfs/ea.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ntfs/ea.c b/fs/ntfs/ea.c
index 2ee700f8227e..98ca9e4f8d25 100644
--- a/fs/ntfs/ea.c
+++ b/fs/ntfs/ea.c
@@ -32,12 +32,12 @@ static int ntfs_write_ea(struct ntfs_inode *ni, __le32 type, char *value, s64 ea
 
 	written = ntfs_inode_attr_pwrite(ea_vi, ea_off, ea_size, value, false);
 	if (written != ea_size)
-		err = -EIO;
+		err = written < 0 ? written : -EIO;
 	else {
 		struct ntfs_inode *ea_ni = NTFS_I(ea_vi);
 
 		if (need_truncate && ea_ni->data_size > ea_off + ea_size)
-			ntfs_attr_truncate(ea_ni, ea_off + ea_size);
+			err = ntfs_attr_truncate(ea_ni, ea_off + ea_size);
 		mark_mft_record_dirty(ni);
 	}
 
-- 
2.51.0


  parent reply	other threads:[~2026-09-23  6:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-23  6:02 [PATCH v4 00/10] ntfs: persist Linux file attributes in an EA Baolin Liu
2026-09-23  6:02 ` [PATCH v4 01/10] ntfs: keep the EA presence flag after creating the first entry Baolin Liu
2026-09-23  6:02 ` [PATCH v4 02/10] ntfs: validate EA chains and link zero-terminated tails Baolin Liu
2026-09-23  6:02 ` Baolin Liu [this message]
2026-09-23  6:02 ` [PATCH v4 04/10] ntfs: preserve EA attribute lookup errors Baolin Liu
2026-09-23  6:02 ` [PATCH v4 05/10] ntfs: distinguish empty EA values from removal Baolin Liu
2026-09-23  6:02 ` [PATCH v4 06/10] ntfs: restore EA attributes when an update fails Baolin Liu
2026-09-23  6:02 ` [PATCH v4 07/10] ntfs: add fileattr query support Baolin Liu
2026-09-23  6:02 ` [PATCH v4 08/10] ntfs: persist immutable in the $LINUXFLAGS EA Baolin Liu
2026-09-23  6:02 ` [PATCH v4 09/10] ntfs: persist append-only " Baolin Liu
2026-09-23  6:02 ` [PATCH v4 10/10] ntfs: persist nodump " Baolin Liu
2026-10-12  3:16 ` [PATCH v4 00/10] ntfs: persist Linux file attributes in an EA liubaolin
2026-10-12  4:43   ` Hyunchul Lee
2026-10-12  5:06     ` Namjae Jeon
2026-10-12  8:15       ` liubaolin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260923060246.2499192-4-liubaolin12138@163.com \
    --to=liubaolin12138@163.com \
    --cc=chenxiaosong@chenxiaosong.com \
    --cc=hyc.lee@gmail.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liubaolin@kylinos.cn \
    --cc=ntfs@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®