]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph...
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 19 Nov 2010 23:32:22 +0000 (15:32 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 19 Nov 2010 23:32:22 +0000 (15:32 -0800)
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client:
  ceph: fix readdir EOVERFLOW on 32-bit archs
  ceph: fix frag offset for non-leftmost frags
  ceph: fix dangling pointer
  ceph: explicitly specify page alignment in network messages
  ceph: make page alignment explicit in osd interface
  ceph: fix comment, remove extraneous args
  ceph: fix update of ctime from MDS
  ceph: fix version check on racing inode updates
  ceph: fix uid/gid on resent mds requests
  ceph: fix rdcache_gen usage and invalidate
  ceph: re-request max_size if cap auth changes
  ceph: only let auth caps update max_size
  ceph: fix open for write on clustered mds
  ceph: fix bad pointer dereference in ceph_fill_trace
  ceph: fix small seq message skipping
  Revert "ceph: update issue_seq on cap grant"

1  2 
fs/ceph/addr.c
fs/ceph/inode.c
fs/ceph/mds_client.c

diff --combined fs/ceph/addr.c
index e9c874abc9e1f4a7ec00b68595fdd674a4f1da2e,4aa8577630370e1a788c289d5cb63421ce985bc5..561438b6a50cd3789b90d54e473562431d528ec8
@@@ -204,7 -204,7 +204,7 @@@ static int readpage_nounlock(struct fil
        err = ceph_osdc_readpages(osdc, ceph_vino(inode), &ci->i_layout,
                                  page->index << PAGE_CACHE_SHIFT, &len,
                                  ci->i_truncate_seq, ci->i_truncate_size,
-                                 &page, 1);
+                                 &page, 1, 0);
        if (err == -ENOENT)
                err = 0;
        if (err < 0) {
@@@ -287,7 -287,7 +287,7 @@@ static int ceph_readpages(struct file *
        rc = ceph_osdc_readpages(osdc, ceph_vino(inode), &ci->i_layout,
                                 offset, &len,
                                 ci->i_truncate_seq, ci->i_truncate_size,
-                                pages, nr_pages);
+                                pages, nr_pages, 0);
        if (rc == -ENOENT)
                rc = 0;
        if (rc < 0)
@@@ -591,6 -591,7 +591,6 @@@ static int ceph_writepages_start(struc
                                 struct writeback_control *wbc)
  {
        struct inode *inode = mapping->host;
 -      struct backing_dev_info *bdi = mapping->backing_dev_info;
        struct ceph_inode_info *ci = ceph_inode(inode);
        struct ceph_fs_client *fsc;
        pgoff_t index, start, end;
  
        pagevec_init(&pvec, 0);
  
 -      /* ?? */
 -      if (wbc->nonblocking && bdi_write_congested(bdi)) {
 -              dout(" writepages congested\n");
 -              wbc->encountered_congestion = 1;
 -              goto out_final;
 -      }
 -
        /* where to start/end? */
        if (wbc->range_cyclic) {
                start = mapping->writeback_index; /* Start from prev offset */
@@@ -774,7 -782,7 +774,7 @@@ get_more_pages
                                            snapc, do_sync,
                                            ci->i_truncate_seq,
                                            ci->i_truncate_size,
-                                           &inode->i_mtime, true, 1);
+                                           &inode->i_mtime, true, 1, 0);
                                max_pages = req->r_num_pages;
  
                                alloc_page_vec(fsc, req);
@@@ -877,6 -885,7 +877,6 @@@ out
                rc = 0;  /* vfs expects us to return 0 */
        ceph_put_snap_context(snapc);
        dout("writepages done, rc = %d\n", rc);
 -out_final:
        return rc;
  }
  
diff --combined fs/ceph/inode.c
index 524b80be4482d0a824a8adddcdfa39656b9eb44b,8153ee5a8d74a053f8777d33867a9b929e5a3afa..bf1286588f26b3afb039e4036ddb2a469fcad638
@@@ -2,6 -2,7 +2,6 @@@
  
  #include <linux/module.h>
  #include <linux/fs.h>
 -#include <linux/smp_lock.h>
  #include <linux/slab.h>
  #include <linux/string.h>
  #include <linux/uaccess.h>
@@@ -470,7 -471,9 +470,9 @@@ void ceph_fill_file_time(struct inode *
  
        if (issued & (CEPH_CAP_FILE_EXCL|
                      CEPH_CAP_FILE_WR|
-                     CEPH_CAP_FILE_BUFFER)) {
+                     CEPH_CAP_FILE_BUFFER|
+                     CEPH_CAP_AUTH_EXCL|
+                     CEPH_CAP_XATTR_EXCL)) {
                if (timespec_compare(ctime, &inode->i_ctime) > 0) {
                        dout("ctime %ld.%09ld -> %ld.%09ld inc w/ cap\n",
                             inode->i_ctime.tv_sec, inode->i_ctime.tv_nsec,
                        warn = 1;
                }
        } else {
-               /* we have no write caps; whatever the MDS says is true */
+               /* we have no write|excl caps; whatever the MDS says is true */
                if (ceph_seq_cmp(time_warp_seq, ci->i_time_warp_seq) >= 0) {
                        inode->i_ctime = *ctime;
                        inode->i_mtime = *mtime;
@@@ -566,12 -569,17 +568,17 @@@ static int fill_inode(struct inode *ino
  
        /*
         * provided version will be odd if inode value is projected,
-        * even if stable.  skip the update if we have a newer info
-        * (e.g., due to inode info racing form multiple MDSs), or if
-        * we are getting projected (unstable) inode info.
+        * even if stable.  skip the update if we have newer stable
+        * info (ours>=theirs, e.g. due to racing mds replies), unless
+        * we are getting projected (unstable) info (in which case the
+        * version is odd, and we want ours>theirs).
+        *   us   them
+        *   2    2     skip
+        *   3    2     skip
+        *   3    3     update
         */
        if (le64_to_cpu(info->version) > 0 &&
-           (ci->i_version & ~1) > le64_to_cpu(info->version))
+           (ci->i_version & ~1) >= le64_to_cpu(info->version))
                goto no_change;
  
        issued = __ceph_caps_issued(ci, &implemented);
                            le32_to_cpu(info->time_warp_seq),
                            &ctime, &mtime, &atime);
  
-       ci->i_max_size = le64_to_cpu(info->max_size);
+       /* only update max_size on auth cap */
+       if ((info->cap.flags & CEPH_CAP_FLAG_AUTH) &&
+           ci->i_max_size != le64_to_cpu(info->max_size)) {
+               dout("max_size %lld -> %llu\n", ci->i_max_size,
+                    le64_to_cpu(info->max_size));
+               ci->i_max_size = le64_to_cpu(info->max_size);
+       }
        ci->i_layout = info->layout;
        inode->i_blkbits = fls(le32_to_cpu(info->layout.fl_stripe_unit)) - 1;
  
@@@ -1054,7 -1069,8 +1068,8 @@@ int ceph_fill_trace(struct super_block 
                ininfo = rinfo->targeti.in;
                vino.ino = le64_to_cpu(ininfo->ino);
                vino.snap = le64_to_cpu(ininfo->snapid);
-               if (!dn->d_inode) {
+               in = dn->d_inode;
+               if (!in) {
                        in = ceph_get_inode(sb, vino);
                        if (IS_ERR(in)) {
                                pr_err("fill_trace bad get_inode "
@@@ -1385,11 -1401,8 +1400,8 @@@ static void ceph_invalidate_work(struc
        spin_lock(&inode->i_lock);
        dout("invalidate_pages %p gen %d revoking %d\n", inode,
             ci->i_rdcache_gen, ci->i_rdcache_revoking);
-       if (ci->i_rdcache_gen == 0 ||
-           ci->i_rdcache_revoking != ci->i_rdcache_gen) {
-               BUG_ON(ci->i_rdcache_revoking > ci->i_rdcache_gen);
+       if (ci->i_rdcache_revoking != ci->i_rdcache_gen) {
                /* nevermind! */
-               ci->i_rdcache_revoking = 0;
                spin_unlock(&inode->i_lock);
                goto out;
        }
        ceph_invalidate_nondirty_pages(inode->i_mapping);
  
        spin_lock(&inode->i_lock);
-       if (orig_gen == ci->i_rdcache_gen) {
+       if (orig_gen == ci->i_rdcache_gen &&
+           orig_gen == ci->i_rdcache_revoking) {
                dout("invalidate_pages %p gen %d successful\n", inode,
                     ci->i_rdcache_gen);
-               ci->i_rdcache_gen = 0;
-               ci->i_rdcache_revoking = 0;
+               ci->i_rdcache_revoking--;
                check = 1;
        } else {
-               dout("invalidate_pages %p gen %d raced, gen now %d\n",
-                    inode, orig_gen, ci->i_rdcache_gen);
+               dout("invalidate_pages %p gen %d raced, now %d revoking %d\n",
+                    inode, orig_gen, ci->i_rdcache_gen,
+                    ci->i_rdcache_revoking);
        }
        spin_unlock(&inode->i_lock);
  
@@@ -1738,7 -1752,7 +1751,7 @@@ int ceph_do_getattr(struct inode *inode
                return 0;
        }
  
-       dout("do_getattr inode %p mask %s\n", inode, ceph_cap_string(mask));
+       dout("do_getattr inode %p mask %s mode 0%o\n", inode, ceph_cap_string(mask), inode->i_mode);
        if (ceph_caps_issued_mask(ceph_inode(inode), mask, 1))
                return 0;
  
diff --combined fs/ceph/mds_client.c
index 7799cac2b629de0f5b7ef47a911d65801261cab9,d22fbbef1959a34756aa282d7b06257104e3a9d2..098b185084791730ba0143111126bc066fdb9afb
@@@ -6,6 -6,7 +6,6 @@@
  #include <linux/sched.h>
  #include <linux/debugfs.h>
  #include <linux/seq_file.h>
 -#include <linux/smp_lock.h>
  
  #include "super.h"
  #include "mds_client.h"
@@@ -528,6 -529,9 +528,9 @@@ static void __register_request(struct c
        ceph_mdsc_get_request(req);
        __insert_request(mdsc, req);
  
+       req->r_uid = current_fsuid();
+       req->r_gid = current_fsgid();
        if (dir) {
                struct ceph_inode_info *ci = ceph_inode(dir);
  
@@@ -1587,8 -1591,8 +1590,8 @@@ static struct ceph_msg *create_request_
  
        head->mdsmap_epoch = cpu_to_le32(mdsc->mdsmap->m_epoch);
        head->op = cpu_to_le32(req->r_op);
-       head->caller_uid = cpu_to_le32(current_fsuid());
-       head->caller_gid = cpu_to_le32(current_fsgid());
+       head->caller_uid = cpu_to_le32(req->r_uid);
+       head->caller_gid = cpu_to_le32(req->r_gid);
        head->args = req->r_args;
  
        ceph_encode_filepath(&p, end, ino1, path1);