summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGordon Ross <gordon.ross@tintri.com>2020-11-23 21:37:26 -0500
committerDan McDonald <danmcd@joyent.com>2020-12-16 12:23:48 -0500
commit3bdb9ca09b6ab38d614222a74178b2590facf48b (patch)
tree4390ea12bcb47a31b70374a50b9a48788f72dac6
parent32187eecd8e0d7104da3064c113e615d34459ad5 (diff)
downloadillumos-joyent-3bdb9ca09b6ab38d614222a74178b2590facf48b.tar.gz
13299 File mtime changes twice, when file is modified using SMB serverrelease-20201217
(Early side-port from OmniOSce)
-rw-r--r--usr/src/uts/common/fs/smbsrv/smb2_write.c3
-rw-r--r--usr/src/uts/common/fs/smbsrv/smb_common_open.c18
-rw-r--r--usr/src/uts/common/fs/smbsrv/smb_node.c10
-rw-r--r--usr/src/uts/common/fs/smbsrv/smb_ofile.c17
-rw-r--r--usr/src/uts/common/fs/smbsrv/smb_write.c13
-rw-r--r--usr/src/uts/common/smbsrv/smb_ktypes.h2
6 files changed, 6 insertions, 57 deletions
diff --git a/usr/src/uts/common/fs/smbsrv/smb2_write.c b/usr/src/uts/common/fs/smbsrv/smb2_write.c
index 776ea24ae1..8f10f67d49 100644
--- a/usr/src/uts/common/fs/smbsrv/smb2_write.c
+++ b/usr/src/uts/common/fs/smbsrv/smb2_write.c
@@ -10,7 +10,7 @@
*/
/*
- * Copyright 2019 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2020 Tintri by DDN, Inc. All rights reserved.
*/
/*
@@ -148,7 +148,6 @@ smb2_write(smb_request_t *sr)
&vdb->vdb_uio, &XferCount, stability);
if (rc)
break;
- of->f_written = B_TRUE;
/* This revokes read cache delegations. */
(void) smb_oplock_break_WRITE(of->f_node, of);
break;
diff --git a/usr/src/uts/common/fs/smbsrv/smb_common_open.c b/usr/src/uts/common/fs/smbsrv/smb_common_open.c
index 8007463ba1..a6902483c2 100644
--- a/usr/src/uts/common/fs/smbsrv/smb_common_open.c
+++ b/usr/src/uts/common/fs/smbsrv/smb_common_open.c
@@ -21,7 +21,7 @@
/*
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2017 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2020 Tintri by DDN, Inc. All rights reserved.
*/
/*
@@ -1147,22 +1147,6 @@ smb_set_open_attributes(smb_request_t *sr, smb_ofile_t *of)
attr.sa_mask |= SMB_AT_MTIME;
}
- /*
- * Used to have code here to set mtime, ctime, atime
- * when the open op->create_disposition is any of:
- * FILE_SUPERSEDE, FILE_OVERWRITE_IF, FILE_OVERWRITE.
- * We know that in those cases we will have set the
- * file size, in which case the file system will
- * update those times, so we don't have to.
- *
- * However, keep track of the fact that we modified
- * the file via this handle, so we can do the evil,
- * gratuitious mtime update on close that Windows
- * clients expect.
- */
- if (op->action_taken == SMB_OACT_TRUNCATED)
- of->f_written = B_TRUE;
-
if (attr.sa_mask != 0)
rc = smb_node_setattr(sr, node, of->f_cr, of, &attr);
diff --git a/usr/src/uts/common/fs/smbsrv/smb_node.c b/usr/src/uts/common/fs/smbsrv/smb_node.c
index 8ce3e70712..2d48a776b2 100644
--- a/usr/src/uts/common/fs/smbsrv/smb_node.c
+++ b/usr/src/uts/common/fs/smbsrv/smb_node.c
@@ -20,7 +20,7 @@
*/
/*
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2019 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2020 Tintri by DDN, Inc. All rights reserved.
*/
/*
* SMB Node State Machine
@@ -1543,14 +1543,6 @@ smb_node_setattr(smb_request_t *sr, smb_node_t *node,
}
/*
- * If we have an open file, and we set the size,
- * then set the "written" flag so that at close,
- * we can force an mtime update.
- */
- if (of != NULL && (attr->sa_mask & SMB_AT_SIZE) != 0)
- of->f_written = B_TRUE;
-
- /*
* When operating on an open file, some settable attributes
* become "sticky" in the open file object until close.
* (see above re. timestamps)
diff --git a/usr/src/uts/common/fs/smbsrv/smb_ofile.c b/usr/src/uts/common/fs/smbsrv/smb_ofile.c
index d5388037c3..6f132cebd3 100644
--- a/usr/src/uts/common/fs/smbsrv/smb_ofile.c
+++ b/usr/src/uts/common/fs/smbsrv/smb_ofile.c
@@ -22,7 +22,7 @@
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2016 Syneto S.R.L. All rights reserved.
* Copyright (c) 2016 by Delphix. All rights reserved.
- * Copyright 2019 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2020 Tintri by DDN, Inc. All rights reserved.
*/
/*
@@ -446,7 +446,6 @@ void
smb_ofile_close(smb_ofile_t *of, int32_t mtime_sec)
{
smb_attr_t *pa;
- timestruc_t now;
SMB_OFILE_VALID(of);
@@ -498,20 +497,6 @@ smb_ofile_close(smb_ofile_t *of, int32_t mtime_sec)
pa->sa_mask |= SMB_AT_MTIME;
}
- /*
- * If we have ever modified data via this handle
- * (write or truncate) and if the mtime was not
- * set via this handle, update the mtime again
- * during the close. Windows expects this.
- * [ MS-FSA 2.1.5.4 "Update Timestamps" ]
- */
- if (of->f_written &&
- (pa->sa_mask & SMB_AT_MTIME) == 0) {
- pa->sa_mask |= SMB_AT_MTIME;
- gethrestime(&now);
- pa->sa_vattr.va_mtime = now;
- }
-
if (of->f_flags & SMB_OFLAGS_SET_DELETE_ON_CLOSE) {
/* We delete using the on-disk name. */
uint32_t flags = SMB_CASE_SENSITIVE;
diff --git a/usr/src/uts/common/fs/smbsrv/smb_write.c b/usr/src/uts/common/fs/smbsrv/smb_write.c
index 6db8cc9e1a..fbf85da282 100644
--- a/usr/src/uts/common/fs/smbsrv/smb_write.c
+++ b/usr/src/uts/common/fs/smbsrv/smb_write.c
@@ -21,7 +21,7 @@
/*
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2017 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2020 Tintri by DDN, Inc. All rights reserved.
*/
#include <sys/sdt.h>
@@ -517,17 +517,6 @@ smb_common_write(smb_request_t *sr, smb_rw_param_t *param)
if (rc)
return (rc);
- /*
- * Used to have code here to set mtime.
- * We have just done a write, so we know
- * the file system will update mtime.
- * No need to do it again here.
- *
- * However, keep track of the fact that
- * we have written data via this handle.
- */
- ofile->f_written = B_TRUE;
-
/* This revokes read cache delegations. */
(void) smb_oplock_break_WRITE(node, ofile);
diff --git a/usr/src/uts/common/smbsrv/smb_ktypes.h b/usr/src/uts/common/smbsrv/smb_ktypes.h
index 8221e23860..ba1a76b792 100644
--- a/usr/src/uts/common/smbsrv/smb_ktypes.h
+++ b/usr/src/uts/common/smbsrv/smb_ktypes.h
@@ -22,6 +22,7 @@
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2019 Nexenta by DDN, Inc. All rights reserved.
* Copyright 2020 RackTop Systems, Inc.
+ * Copyright 2020 Tintri by DDN, Inc. All rights reserved.
*/
/*
@@ -1425,7 +1426,6 @@ typedef struct smb_ofile {
cred_t *f_cr;
pid_t f_pid;
smb_attr_t f_pending_attr;
- boolean_t f_written;
smb_oplock_grant_t f_oplock;
uint8_t TargetOplockKey[SMB_LEASE_KEY_SZ];
uint8_t ParentOplockKey[SMB_LEASE_KEY_SZ];