mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>,
	Klara Modin <klarasmodin@gmail.com>,
	Christian Brauner <brauner@kernel.org>,
	Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	Jeff Layton <jlayton@kernel.org>
Subject: [PATCH] fat: fix mtime handing in __fat_write_inode
Date: Wed, 18 Oct 2023 07:15:40 -0400	[thread overview]
Message-ID: <20231018-amtime-v1-1-e066bae97285@kernel.org> (raw)

Klara reported seeing mangled mtimes when dealing with FAT. Fix the
braino in the FAT conversion to the new timestamp accessors.

Fixes: e57260ae3226 (fat: convert to new timestamp accessors)
Reported-by: Klara Modin <klarasmodin@gmail.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
This patch fixes the bug that Klara reported late yesterday. The issue
is a bad by-hand conversion of __fat_write_inode to the new timestamp
accessor functions.

Christian, this patch should probably be squashed into e57260ae3226.

Thanks!
Jeff
---
 fs/fat/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index aa87f323fd44..1fac3dabf130 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -888,9 +888,9 @@ static int __fat_write_inode(struct inode *inode, int wait)
 		raw_entry->size = cpu_to_le32(inode->i_size);
 	raw_entry->attr = fat_make_attrs(inode);
 	fat_set_start(raw_entry, MSDOS_I(inode)->i_logstart);
+	mtime = inode_get_mtime(inode);
 	fat_time_unix2fat(sbi, &mtime, &raw_entry->time,
 			  &raw_entry->date, NULL);
-	inode_set_mtime_to_ts(inode, mtime);
 	if (sbi->options.isvfat) {
 		struct timespec64 ts = inode_get_atime(inode);
 		__le16 atime;

---
base-commit: fea0e8fc7829dc85f82c8a1a8249630f6fb85553
change-id: 20231018-amtime-24d2effcc9a9

Best regards,
-- 
Jeff Layton <jlayton@kernel.org>


             reply	other threads:[~2023-10-18 11:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-18 11:15 Jeff Layton [this message]
2023-10-18 11:27 ` Christian Brauner
2023-10-18 11:44 ` Klara Modin
2023-10-18 11:55   ` Jeff Layton
2023-10-18 12:03     ` Klara Modin
2023-10-18 12:09       ` Christian Brauner

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=20231018-amtime-v1-1-e066bae97285@kernel.org \
    --to=jlayton@kernel.org \
    --cc=brauner@kernel.org \
    --cc=hirofumi@mail.parknet.co.jp \
    --cc=klarasmodin@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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®