]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
kclient: fix fill_file_bits logic
authorSage Weil <sage@newdream.net>
Sat, 17 Jan 2009 00:07:42 +0000 (16:07 -0800)
committerSage Weil <sage@newdream.net>
Sat, 17 Jan 2009 00:07:54 +0000 (16:07 -0800)
ctime should be the max if we hold any wr caps, otherwise it's
the mds value, regardless of time_warp_seq (which does not modify
ctime).

src/include/ceph_fs.h
src/kernel/inode.c

index 273343e849f5a6bf531f90208a1b8fbf1fe949e7..d9d4147ba99974dd8b4d1da222b0965b92b3634b 100644 (file)
@@ -958,7 +958,7 @@ static inline int ceph_flags_to_mode(int flags)
                           CEPH_CAP_LINK_EXCL |         \
                           CEPH_CAP_XATTR_EXCL |        \
                           CEPH_CAP_FILE_EXCL)
-#define CEPH_CAP_ANY_FILE_WR ((CEPH_CAP_GWR|CEPH_CAP_GWRBUFFER) << CEPH_CAP_SFILE)
+#define CEPH_CAP_ANY_FILE_WR (CEPH_CAP_FILE_WR|CEPH_CAP_FILE_WRBUFFER)
 #define CEPH_CAP_ANY_WR   (CEPH_CAP_ANY_EXCL | CEPH_CAP_ANY_FILE_WR)
 
 /*
index 2e3a9968215a1883e301fc51938d1fb1e120bca4..2bf2bc6da400d1c8ceab622cf8e626630866e35b 100644 (file)
@@ -343,30 +343,24 @@ void ceph_fill_file_bits(struct inode *inode, int issued,
                ci->i_truncate_seq = truncate_seq;
        }
 
-       if (issued & CEPH_CAP_FILE_EXCL) {
-               /*
-                * if we hold EXCL cap, we have the most up to date
-                * values for everything except possibly ctime.
-                */
+       if (issued & (CEPH_CAP_FILE_EXCL|
+                     CEPH_CAP_FILE_WR|
+                     CEPH_CAP_FILE_WRBUFFER)) {
                if (timespec_compare(ctime, &inode->i_ctime) > 0)
                        inode->i_ctime = *ctime;
-               if (ceph_seq_cmp(time_warp_seq, ci->i_time_warp_seq) > 0)
-                       derr(0, "WARNING: %p mds time_warp_seq %llu > %llu\n",
-                            inode, time_warp_seq, ci->i_time_warp_seq);
-       } else if (issued & (CEPH_CAP_FILE_WR|CEPH_CAP_FILE_WRBUFFER)) {
                if (ceph_seq_cmp(time_warp_seq, ci->i_time_warp_seq) > 0) {
                        /* the MDS did a utimes() */
-                       inode->i_ctime = *ctime;
                        inode->i_mtime = *mtime;
                        inode->i_atime = *atime;
                        ci->i_time_warp_seq = time_warp_seq;
                } else if (time_warp_seq == ci->i_time_warp_seq) {
-                       if (timespec_compare(ctime, &inode->i_ctime) > 0)
-                               inode->i_ctime = *ctime;
+                       /* nobody did utimes(); take the max */
                        if (timespec_compare(mtime, &inode->i_mtime) > 0)
                                inode->i_mtime = *mtime;
                        if (timespec_compare(atime, &inode->i_atime) > 0)
                                inode->i_atime = *atime;
+               } else if (issued & CEPH_CAP_FILE_EXCL) {
+                       /* we did a utimes(); ignore mds values */
                } else {
                        warn = 1;
                }