All of lore.kernel.org
 help / color / mirror / Atom feed
* Fix setting EOF
@ 2023-03-13 15:19 Volker Lendecke
  2023-03-13 15:24 ` Volker Lendecke
  0 siblings, 1 reply; 6+ messages in thread
From: Volker Lendecke @ 2023-03-13 15:19 UTC (permalink / raw)
  To: linux-cifs

[-- Attachment #1: Type: text/plain, Size: 113 bytes --]

Hi!

b6f2a0f89d7ed introduced looking for a writable path. This patch
should probably have gone with it.

Volker

[-- Attachment #2: 0001-cifs-Fix-smb2_set_path_size.patch --]
[-- Type: text/x-diff, Size: 1708 bytes --]

From 4b72cd033b5ad1143b11305b07c9fab5c9b610ca Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl@samba.org>
Date: Mon, 13 Mar 2023 16:09:54 +0100
Subject: [PATCH] cifs: Fix smb2_set_path_size()

If cifs_get_writable_path() finds a writable file, smb2_compound_op()
must use that file's FID and not the COMPOUND_FID.

Signed-off-by: Volker Lendecke <vl@samba.org>
---
 fs/cifs/smb2inode.c | 28 +++++++++++++++++++++++-----
 1 file changed, 23 insertions(+), 5 deletions(-)

diff --git a/fs/cifs/smb2inode.c b/fs/cifs/smb2inode.c
index 9b956294e864..63541ad1bab2 100644
--- a/fs/cifs/smb2inode.c
+++ b/fs/cifs/smb2inode.c
@@ -234,11 +234,29 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
 		size[0] = 8; /* sizeof __le64 */
 		data[0] = ptr;
 
-		rc = SMB2_set_info_init(tcon, server,
-					&rqst[num_rqst], COMPOUND_FID,
-					COMPOUND_FID, current->tgid,
-					FILE_END_OF_FILE_INFORMATION,
-					SMB2_O_INFO_FILE, 0, data, size);
+		if (cfile) {
+			rc = SMB2_set_info_init(tcon, server,
+						&rqst[num_rqst],
+						cfile->fid.persistent_fid,
+						cfile->fid.volatile_fid,
+						current->tgid,
+						FILE_END_OF_FILE_INFORMATION,
+						SMB2_O_INFO_FILE, 0,
+						data, size);
+		} else {
+			rc = SMB2_set_info_init(tcon, server,
+						&rqst[num_rqst],
+						COMPOUND_FID,
+						COMPOUND_FID,
+						current->tgid,
+						FILE_END_OF_FILE_INFORMATION,
+						SMB2_O_INFO_FILE, 0,
+						data, size);
+			if (!rc) {
+				smb2_set_next_command(tcon, &rqst[num_rqst]);
+				smb2_set_related(&rqst[num_rqst]);
+			}
+		}
 		if (rc)
 			goto finished;
 		smb2_set_next_command(tcon, &rqst[num_rqst]);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: Fix setting EOF
  2023-03-13 15:19 Fix setting EOF Volker Lendecke
@ 2023-03-13 15:24 ` Volker Lendecke
  2023-03-13 15:28   ` Volker Lendecke
  0 siblings, 1 reply; 6+ messages in thread
From: Volker Lendecke @ 2023-03-13 15:24 UTC (permalink / raw)
  To: linux-cifs

Am Mon, Mar 13, 2023 at 04:19:35PM +0100 schrieb Volker Lendecke:
> b6f2a0f89d7ed introduced looking for a writable path. This patch
> should probably have gone with it.

Skip that, patch is incomplete. Will submit a fixed one v soon.

Volker

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Fix setting EOF
  2023-03-13 15:24 ` Volker Lendecke
@ 2023-03-13 15:28   ` Volker Lendecke
  2023-03-13 15:42     ` Volker Lendecke
  0 siblings, 1 reply; 6+ messages in thread
From: Volker Lendecke @ 2023-03-13 15:28 UTC (permalink / raw)
  To: linux-cifs

[-- Attachment #1: Type: text/plain, Size: 370 bytes --]

Am Mon, Mar 13, 2023 at 04:24:57PM +0100 schrieb Volker Lendecke:
> Am Mon, Mar 13, 2023 at 04:19:35PM +0100 schrieb Volker Lendecke:
> > b6f2a0f89d7ed introduced looking for a writable path. This patch
> > should probably have gone with it.
> 
> Skip that, patch is incomplete. Will submit a fixed one v soon.

Here's the updated version.

Sorry for the noise,

Volker

[-- Attachment #2: 0001-cifs-Fix-smb2_set_path_size.patch --]
[-- Type: text/x-diff, Size: 1856 bytes --]

From 0c9b00471a53661be91d55928e943eaae0674b2c Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl@samba.org>
Date: Mon, 13 Mar 2023 16:09:54 +0100
Subject: [PATCH] cifs: Fix smb2_set_path_size()

If cifs_get_writable_path() finds a writable file, smb2_compound_op()
must use that file's FID and not the COMPOUND_FID.

Signed-off-by: Volker Lendecke <vl@samba.org>
---
 fs/cifs/smb2inode.c | 30 +++++++++++++++++++++++-------
 1 file changed, 23 insertions(+), 7 deletions(-)

diff --git a/fs/cifs/smb2inode.c b/fs/cifs/smb2inode.c
index 9b956294e864..aa67271b3cc9 100644
--- a/fs/cifs/smb2inode.c
+++ b/fs/cifs/smb2inode.c
@@ -234,15 +234,31 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
 		size[0] = 8; /* sizeof __le64 */
 		data[0] = ptr;
 
-		rc = SMB2_set_info_init(tcon, server,
-					&rqst[num_rqst], COMPOUND_FID,
-					COMPOUND_FID, current->tgid,
-					FILE_END_OF_FILE_INFORMATION,
-					SMB2_O_INFO_FILE, 0, data, size);
+		if (cfile) {
+			rc = SMB2_set_info_init(tcon, server,
+						&rqst[num_rqst],
+						cfile->fid.persistent_fid,
+						cfile->fid.volatile_fid,
+						current->tgid,
+						FILE_END_OF_FILE_INFORMATION,
+						SMB2_O_INFO_FILE, 0,
+						data, size);
+		} else {
+			rc = SMB2_set_info_init(tcon, server,
+						&rqst[num_rqst],
+						COMPOUND_FID,
+						COMPOUND_FID,
+						current->tgid,
+						FILE_END_OF_FILE_INFORMATION,
+						SMB2_O_INFO_FILE, 0,
+						data, size);
+			if (!rc) {
+				smb2_set_next_command(tcon, &rqst[num_rqst]);
+				smb2_set_related(&rqst[num_rqst]);
+			}
+		}
 		if (rc)
 			goto finished;
-		smb2_set_next_command(tcon, &rqst[num_rqst]);
-		smb2_set_related(&rqst[num_rqst++]);
 		trace_smb3_set_eof_enter(xid, ses->Suid, tcon->tid, full_path);
 		break;
 	case SMB2_OP_SET_INFO:
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: Fix setting EOF
  2023-03-13 15:28   ` Volker Lendecke
@ 2023-03-13 15:42     ` Volker Lendecke
  2023-03-14 15:16       ` Paulo Alcantara
  2023-03-14 19:44       ` Steve French
  0 siblings, 2 replies; 6+ messages in thread
From: Volker Lendecke @ 2023-03-13 15:42 UTC (permalink / raw)
  To: linux-cifs

[-- Attachment #1: Type: text/plain, Size: 161 bytes --]

Am Mon, Mar 13, 2023 at 04:28:37PM +0100 schrieb Volker Lendecke:
> Here's the updated version.
> 
> Sorry for the noise,

It's not my day today, V3....

Volker

[-- Attachment #2: 0001-cifs-Fix-smb2_set_path_size.patch --]
[-- Type: text/x-diff, Size: 1873 bytes --]

From 41e6250b60b5ba3d262b50f97e8b01df67ccecc4 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl@samba.org>
Date: Mon, 13 Mar 2023 16:09:54 +0100
Subject: [PATCH] cifs: Fix smb2_set_path_size()

If cifs_get_writable_path() finds a writable file, smb2_compound_op()
must use that file's FID and not the COMPOUND_FID.

Signed-off-by: Volker Lendecke <vl@samba.org>
---
 fs/cifs/smb2inode.c | 31 ++++++++++++++++++++++++-------
 1 file changed, 24 insertions(+), 7 deletions(-)

diff --git a/fs/cifs/smb2inode.c b/fs/cifs/smb2inode.c
index 9b956294e864..8dd3791b5c53 100644
--- a/fs/cifs/smb2inode.c
+++ b/fs/cifs/smb2inode.c
@@ -234,15 +234,32 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
 		size[0] = 8; /* sizeof __le64 */
 		data[0] = ptr;
 
-		rc = SMB2_set_info_init(tcon, server,
-					&rqst[num_rqst], COMPOUND_FID,
-					COMPOUND_FID, current->tgid,
-					FILE_END_OF_FILE_INFORMATION,
-					SMB2_O_INFO_FILE, 0, data, size);
+		if (cfile) {
+			rc = SMB2_set_info_init(tcon, server,
+						&rqst[num_rqst],
+						cfile->fid.persistent_fid,
+						cfile->fid.volatile_fid,
+						current->tgid,
+						FILE_END_OF_FILE_INFORMATION,
+						SMB2_O_INFO_FILE, 0,
+						data, size);
+		} else {
+			rc = SMB2_set_info_init(tcon, server,
+						&rqst[num_rqst],
+						COMPOUND_FID,
+						COMPOUND_FID,
+						current->tgid,
+						FILE_END_OF_FILE_INFORMATION,
+						SMB2_O_INFO_FILE, 0,
+						data, size);
+			if (!rc) {
+				smb2_set_next_command(tcon, &rqst[num_rqst]);
+				smb2_set_related(&rqst[num_rqst]);
+			}
+		}
 		if (rc)
 			goto finished;
-		smb2_set_next_command(tcon, &rqst[num_rqst]);
-		smb2_set_related(&rqst[num_rqst++]);
+		num_rqst++;
 		trace_smb3_set_eof_enter(xid, ses->Suid, tcon->tid, full_path);
 		break;
 	case SMB2_OP_SET_INFO:
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: Fix setting EOF
  2023-03-13 15:42     ` Volker Lendecke
@ 2023-03-14 15:16       ` Paulo Alcantara
  2023-03-14 19:44       ` Steve French
  1 sibling, 0 replies; 6+ messages in thread
From: Paulo Alcantara @ 2023-03-14 15:16 UTC (permalink / raw)
  To: Volker.Lendecke, linux-cifs

Volker Lendecke <Volker.Lendecke@sernet.de> writes:

> Am Mon, Mar 13, 2023 at 04:28:37PM +0100 schrieb Volker Lendecke:
> From 41e6250b60b5ba3d262b50f97e8b01df67ccecc4 Mon Sep 17 00:00:00 2001
> From: Volker Lendecke <vl@samba.org>
> Date: Mon, 13 Mar 2023 16:09:54 +0100
> Subject: [PATCH] cifs: Fix smb2_set_path_size()
>
> If cifs_get_writable_path() finds a writable file, smb2_compound_op()
> must use that file's FID and not the COMPOUND_FID.
>
> Signed-off-by: Volker Lendecke <vl@samba.org>
> ---
>  fs/cifs/smb2inode.c | 31 ++++++++++++++++++++++++-------
>  1 file changed, 24 insertions(+), 7 deletions(-)

Looks good.  Thanks!

Reviewed-by: Paulo Alcantara (SUSE) <pc@manguebit.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Fix setting EOF
  2023-03-13 15:42     ` Volker Lendecke
  2023-03-14 15:16       ` Paulo Alcantara
@ 2023-03-14 19:44       ` Steve French
  1 sibling, 0 replies; 6+ messages in thread
From: Steve French @ 2023-03-14 19:44 UTC (permalink / raw)
  To: Volker.Lendecke; +Cc: linux-cifs

merged into cifs-2.6 for-next and added Cc:stable (and RB from Paulo).

On Mon, Mar 13, 2023 at 10:47 AM Volker Lendecke
<Volker.Lendecke@sernet.de> wrote:
>
> Am Mon, Mar 13, 2023 at 04:28:37PM +0100 schrieb Volker Lendecke:
> > Here's the updated version.
> >
> > Sorry for the noise,
>
> It's not my day today, V3....
>
> Volker



-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-03-14 19:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-13 15:19 Fix setting EOF Volker Lendecke
2023-03-13 15:24 ` Volker Lendecke
2023-03-13 15:28   ` Volker Lendecke
2023-03-13 15:42     ` Volker Lendecke
2023-03-14 15:16       ` Paulo Alcantara
2023-03-14 19:44       ` Steve French

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.