diff options
author | Gordon Ross <gordon.ross@tintri.com> | 2020-11-23 21:37:26 -0500 |
---|---|---|
committer | Gordon Ross <gordon.ross@tintri.com> | 2021-02-08 15:23:13 -0500 |
commit | a8e9db1c816399e66d096a343815a6e845a7a0cd (patch) | |
tree | 20412e2b0f0addf7b10543ee52cb67e75a8391dd /usr/src | |
parent | f74a127feb6111d3b6890ae374a142eda1fd4e3e (diff) | |
download | illumos-joyent-a8e9db1c816399e66d096a343815a6e845a7a0cd.tar.gz |
13299 File mtime changes twice, when file is modified using SMB server
Reviewed by: Florian Manschwetus <manschwetus@cs-software-gmbh.de>
Reviewed by: Andy Fiddaman <andy@omniosce.org>
Reviewed by: Dominik Hassler <hadfl@omniosce.org>
Approved by: Dan McDonald <danmcd@joyent.com>
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/uts/common/fs/smbsrv/smb2_write.c | 3 | ||||
-rw-r--r-- | usr/src/uts/common/fs/smbsrv/smb_common_open.c | 18 | ||||
-rw-r--r-- | usr/src/uts/common/fs/smbsrv/smb_node.c | 10 | ||||
-rw-r--r-- | usr/src/uts/common/fs/smbsrv/smb_ofile.c | 17 | ||||
-rw-r--r-- | usr/src/uts/common/fs/smbsrv/smb_write.c | 13 | ||||
-rw-r--r-- | usr/src/uts/common/smbsrv/smb_ktypes.h | 3 |
6 files changed, 6 insertions, 58 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 454d48364c..fb4d46f599 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 2020 Nexenta by DDN, Inc. All rights reserved. + * Copyright 2020 Tintri by DDN, Inc. All rights reserved. */ /* @@ -1252,22 +1252,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 e159bbc9e6..174f48f970 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 @@ -1544,14 +1544,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..3bdb713337 100644 --- a/usr/src/uts/common/smbsrv/smb_ktypes.h +++ b/usr/src/uts/common/smbsrv/smb_ktypes.h @@ -20,8 +20,8 @@ */ /* * 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 +1425,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]; |