FAILED: patch "[PATCH] 9p: Fix v9fs_issue_write() to update i_size and remote_i_size" failed to apply to 6.12-stable tree
[email protected]
maintainerThe patch below does not apply to the 6.12-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-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x c60ae98c5aa64021751b38ab1313b19d620bf640
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026092222-rubbing-overplay-5a22@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From c60ae98c5aa64021751b38ab1313b19d620bf640 Mon Sep 17 00:00:00 2001
From: David Howells <[email protected]>
Date: Fri, 11 Sep 2026 10:25:04 +0100
Subject: [PATCH] 9p: Fix v9fs_issue_write() to update i_size and remote_i_size
Fix v9fs_issue_write() to update i_size and remote_i_size to the new size of the server file if we made it larger, using the start fpos and the count returned by p9_client_write() to calculate the new minimum file size.
This assumes that if the 9P server makes a short write (say it hits ENOSPC), a reduced count is returned.
Message-ID: <[email protected]>
fs/9p/vfs_addr.c +27 -1
@@ -54,11 +54,37 @@ static void v9fs_begin_writeback(struct netfs_io_request *wreq)static void v9fs_issue_write (struct netfs_io_subrequest *subreq) {struct p9_fid *fid = subreq->rreq->netfs_priv; +struct inode *inode = subreq->rreq->inode; +struct netfs_inode *ictx =netfs_inode (inode);int err, len; len =p9_client_write (fid, subreq->start, &subreq->io_iter, &err); -if (len >0 ) +if (len >0 ) { +uoff_t end = subreq->start + len, i_size, remote, zp; +bool set = false; + +spin_lock (&inode->i_lock); + +/* We can read the sizes directly as we hold i_lock. */ + i_size = inode->i_size; + remote = ictx->_remote_i_size; + zp = ictx->_zero_point; + +if (end > i_size) { + i_size = end; + set = true; + } +if (end > remote) { + remote = end; + set = true; + } + +if (set) +netfs_write_sizes (inode, i_size, remote, zp); +spin_unlock (&inode->i_lock); +__set_bit (NETFS_SREQ_MADE_PROGRESS , &subreq->flags); + }netfs_write_subrequest_terminated (subreq, len ?: err); }
Sasha Levin
maintainerPATCH 1/2 cifs: Fix specification of function pointers
From: David Howells <[email protected]>
[ Upstream commit 6a86a4cc281a5cfceda7af60ea6fa506b3db7430 ]
Change the mid_receive_t, mid_callback_t and mid_handle_t function pointers to have the pointer marker in the typedef.
Stable-dep-of: c60ae98c5aa6 ("9p: Fix v9fs_issue_write() to update i_size and remote_i_size")
--- fs/smb/client/cifsglob.h | 12 ++++++------ fs/smb/client/cifsproto.h | 8 ++++---- fs/smb/client/transport.c | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-)
fs/smb/client/cifsglob.h +6 -6
@@ -1619,7 +1619,7 @@ static inline void cifs_stats_bytes_read(struct cifs_tcon *tcon,* Returns zero on a successful receive, or an error. The receive state in * the TCP_Server_Info will also be updated. */ -typedef int (mid_receive_t )(struct TCP_Server_Info *server, +typedef int (*mid_receive_t )(struct TCP_Server_Info *server,struct mid_q_entry *mid);/*
@@ -1630,13 +1630,13 @@ typedef int (mid_receive_t)(struct TCP_Server_Info *server,* - it will be called by cifsd, with no locks held * - the mid will be removed from any lists */ -typedef void (mid_callback_t )(struct mid_q_entry *mid); +typedef void (*mid_callback_t )(struct mid_q_entry *mid);/* * This is the protopyte for mid handle function. This is called once the mid * has been recognized after decryption of the message. */ -typedef int (mid_handle_t )(struct TCP_Server_Info *server, +typedef int (*mid_handle_t )(struct TCP_Server_Info *server,struct mid_q_entry *mid);/* one of these for every pending CIFS request to the server */
@@ -1654,9 +1654,9 @@ struct mid_q_entry {unsigned long when_sent;/* time when smb send finished */ unsigned long when_received;/* when demux complete (taken off wire) */ #endif -mid_receive_t *receive;/* call receive callback */ -mid_callback_t *callback;/* call completion callback */ -mid_handle_t *handle;/* call handle mid callback */ +mid_receive_t receive;/* call receive callback */ +mid_callback_t callback;/* call completion callback */ +mid_handle_t handle;/* call handle mid callback */ void *callback_data;/* general purpose pointer for callback */ struct task_struct *creator;void *resp_buf;/* pointer to received SMB header */
fs/smb/client/cifsproto.h +4 -4
@@ -96,10 +96,10 @@ extern int cifs_ipaddr_cmp(struct sockaddr *srcaddr, struct sockaddr *rhs);extern bool cifs_match_ipaddr (struct sockaddr *srcaddr,struct sockaddr *rhs);extern int cifs_discard_remaining_data (struct TCP_Server_Info *server);extern int cifs_call_async (struct TCP_Server_Info *server, -struct smb_rqst *rqst, -mid_receive_t *receive,mid_callback_t *callback, -mid_handle_t *handle,void *cbdata,const int flags, -const struct cifs_credits *exist_credits); +struct smb_rqst *rqst, +mid_receive_t receive,mid_callback_t callback, +mid_handle_t handle,void *cbdata,const int flags, +const struct cifs_credits *exist_credits);extern struct TCP_Server_Info *cifs_pick_channel (struct cifs_ses *ses); extern int cifs_send_recv(const unsigned int xid, struct cifs_ses *ses, struct TCP_Server_Info *server,
fs/smb/client/transport.c +2 -2
@@ -792,8 +792,8 @@ cifs_setup_async_request(struct TCP_Server_Info *server, struct smb_rqst *rqst)*/ int cifs_call_async (struct TCP_Server_Info *server,struct smb_rqst *rqst, -mid_receive_t *receive,mid_callback_t *callback, -mid_handle_t *handle,void *cbdata,const int flags, +mid_receive_t receive,mid_callback_t callback, +mid_handle_t handle,void *cbdata,const int flags,const struct cifs_credits *exist_credits) {int rc;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/2 9p: Fix v9fs_issue_write() to update i_size and remote_i_size
From: David Howells <[email protected]>
[ Upstream commit c60ae98c5aa64021751b38ab1313b19d620bf640 ]
Fix v9fs_issue_write() to update i_size and remote_i_size to the new size of the server file if we made it larger, using the start fpos and the count returned by p9_client_write() to calculate the new minimum file size.
This assumes that if the 9P server makes a short write (say it hits ENOSPC), a reduced count is returned.
Message-ID: <[email protected]>
--- fs/9p/vfs_addr.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
fs/9p/vfs_addr.c +12 -0
@@ -54,9 +54,21 @@ static void v9fs_begin_writeback(struct netfs_io_request *wreq)static void v9fs_issue_write (struct netfs_io_subrequest *subreq) {struct p9_fid *fid = subreq->rreq->netfs_priv; +struct inode *inode = subreq->rreq->inode; +struct netfs_inode *ictx =netfs_inode (inode);int err, len; len =p9_client_write (fid, subreq->start, &subreq->io_iter, &err); +if (len >0 ) { +unsigned long long end = subreq->start + len; + +spin_lock (&inode->i_lock); +if (end >i_size_read (inode)) +i_size_write (inode, end); +if (end > ictx->remote_i_size) + ictx->remote_i_size = end; +spin_unlock (&inode->i_lock); + }netfs_write_subrequest_terminated (subreq, len ?: err, false); }
Signature · 1 line
2.53.0