Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Shyam Prasad N <nspmangalore@gmail.com>
Cc: dhowells@redhat.com, Bharath SM <bharathsm.hsk@gmail.com>,
	Mark A Whiting <whitingm@opentext.com>,
	henrique.carvalho@suse.com, Enzo Matsumiya <ematsumiya@suse.de>,
	Steve French <smfrench@gmail.com>,
	Paulo Alcantara <pc@manguebit.org>,
	"Heckmann, Ilja" <heckmann@izw-berlin.de>,
	"linux-cifs@vger.kernel.org" <linux-cifs@vger.kernel.org>
Subject: Re: [[ EXT ]] [BUG REPORT] cifs/smb data corruption when writing, x86_64, kernel 6.6.71
Date: Wed, 12 Nov 2025 18:14:07 +0000	[thread overview]
Message-ID: <1392200.1762971247@warthog.procyon.org.uk> (raw)
In-Reply-To: <CANT5p=px8Lh1C2O0F8i1htoMACWZbLPfw0NEzUco5Njss2c7pQ@mail.gmail.com>

Shyam Prasad N <nspmangalore@gmail.com> wrote:

> 4. Page 2 is now written to by the next write, which extends the file
> by another 5k. Page 2 and 3 are now marked dirty.

It sounds like this is the crux of the problem.

The caller, cifs_write_back_from_locked_folio() has a stale copy of ->i_size.

I think we need to do one or more of:

 (1) our copy of i_size should be updated by cifs_extend_writeback() whilst we
     hold the lock on a folio

 (2) we should reject on what appears (given the stale i_size) to be a partial
     folio if inode->i_size changed

 (3) cifs_extend_writeback() should just stop - and maybe abandon the current
     batch - if it sees i_size has changed.

     Note that abandoning the contents of the batch rather than doing the
     flag-flipping loop is fine as they're merely locked to that point and we
     don't have to reverse the PG_dirty -> PG_write transition.

David


  reply	other threads:[~2025-11-12 18:14 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-25 21:24 [BUG REPORT] cifs/smb data corruption when writing, x86_64, kernel 6.6.71 Mark A Whiting
2025-03-26 10:11 ` AW: [[ EXT ]] " Heckmann, Ilja
2025-03-26 18:58   ` Steve French
2025-03-26 21:13     ` Enzo Matsumiya
2025-03-27 12:48       ` Mark A Whiting
2025-03-27 13:07         ` Enzo Matsumiya
2025-03-27 19:31           ` [EXTERNAL] - " Mark A Whiting
2025-03-31 19:47           ` Mark A Whiting
2025-11-06 15:00             ` Bharath SM
2025-11-06 15:20               ` Enzo Matsumiya
2025-11-06 15:51                 ` Bharath SM
2025-11-06 16:03                   ` Enzo Matsumiya
2025-11-10 15:56                 ` David Howells
2025-11-06 16:22               ` David Howells
2025-11-06 16:46                 ` Bharath SM
2025-11-06 16:49                   ` Bharath SM
2025-11-10 16:00               ` David Howells
2025-11-11  9:22               ` David Howells
2025-11-11 10:39                 ` Shyam Prasad N
2025-11-12 17:09                   ` Shyam Prasad N
2025-11-12 18:14                     ` David Howells [this message]
2025-11-13 12:04                       ` Shyam Prasad N
2025-11-13 13:57                         ` David Howells
2025-11-14  9:27                           ` Shyam Prasad N
2025-11-14 10:49                             ` David Howells
2025-11-14 10:57                               ` Shyam Prasad N
2025-11-07 12:54           ` Shyam Prasad N
2025-11-10  4:37             ` Shyam Prasad N
2025-03-27 10:09     ` AW: [[ EXT ]] " Heckmann, Ilja

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=1392200.1762971247@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=bharathsm.hsk@gmail.com \
    --cc=ematsumiya@suse.de \
    --cc=heckmann@izw-berlin.de \
    --cc=henrique.carvalho@suse.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=nspmangalore@gmail.com \
    --cc=pc@manguebit.org \
    --cc=smfrench@gmail.com \
    --cc=whitingm@opentext.com \
    /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