summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2008-03-14 19:21:31 +0000
committerSteve French <sfrench@us.ibm.com>2008-03-14 19:21:31 +0000
commit50531444fac593c8c8e3ff2e41944d9507bb4665 (patch)
treeda888faac8dffd99b651d9bb64cd10871bffa097
parentbc5b6e24a17f90c7d096d857650f4739cc95c941 (diff)
downloadblackbird-op-linux-50531444fac593c8c8e3ff2e41944d9507bb4665.tar.gz
blackbird-op-linux-50531444fac593c8c8e3ff2e41944d9507bb4665.zip
[CIFS] Fix mtime on cp -p when file data cached but written out too late
Kukks noticed that cp -p can write out file data too late, after the timestamp is already set. This was introduced as an unintentional sideeffect of the change in an earlier patch (see below) which fixed some delayed return code propagation. cea218054ad277d6c126890213afde07b4eb1602 Author: Jeff Layton <jlayton@redhat.com> Date: Tue Nov 20 23:19:03 2007 +0000 Acked-by: Shirish Pargaonkar <shirishp@us.ibm.com> Acked-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
-rw-r--r--fs/cifs/inode.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index af422625cee6..e57e5c46ad48 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -1420,11 +1420,10 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
}
cifsInode = CIFS_I(direntry->d_inode);
- /* BB check if we need to refresh inode from server now ? BB */
-
- if (attrs->ia_valid & ATTR_SIZE) {
+ if ((attrs->ia_valid & ATTR_MTIME) || (attrs->ia_valid & ATTR_SIZE)) {
/*
- Flush data before changing file size on server. If the
+ Flush data before changing file size or changing the last
+ write time of the file on the server. If the
flush returns error, store it to report later and continue.
BB: This should be smarter. Why bother flushing pages that
will be truncated anyway? Also, should we error out here if
@@ -1435,7 +1434,9 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
CIFS_I(direntry->d_inode)->write_behind_rc = rc;
rc = 0;
}
+ }
+ if (attrs->ia_valid & ATTR_SIZE) {
/* To avoid spurious oplock breaks from server, in the case of
inodes that we already have open, avoid doing path based
setting of file size if we can do it by handle.
OpenPOWER on IntegriCloud