Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph...
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 9 Sep 2013 16:13:22 +0000 (09:13 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 9 Sep 2013 16:13:22 +0000 (09:13 -0700)
Pull ceph updates from Sage Weil:
 "This includes both the first pile of Ceph patches (which I sent to
  torvalds@vger, sigh) and a few new patches that add support for
  fscache for Ceph.  That includes a few fscache core fixes that David
  Howells asked go through the Ceph tree.  (Thanks go to Milosz Tanski
  for putting this feature together)

  This first batch of patches (included here) had (has) several
  important RBD bug fixes, hole punch support, several different
  cleanups in the page cache interactions, improvements in the truncate
  code (new truncate mutex to avoid shenanigans with i_mutex), and a
  series of fixes in the synchronous striping read/write code.

  On top of that is a random collection of small fixes all across the
  tree (error code checks and error path cleanup, obsolete wq flags,
  etc)"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client: (43 commits)
  ceph: use d_invalidate() to invalidate aliases
  ceph: remove ceph_lookup_inode()
  ceph: trivial buildbot warnings fix
  ceph: Do not do invalidate if the filesystem is mounted nofsc
  ceph: page still marked private_2
  ceph: ceph_readpage_to_fscache didn't check if marked
  ceph: clean PgPrivate2 on returning from readpages
  ceph: use fscache as a local presisent cache
  fscache: Netfs function for cleanup post readpages
  FS-Cache: Fix heading in documentation
  CacheFiles: Implement interface to check cache consistency
  FS-Cache: Add interface to check consistency of a cached object
  rbd: fix null dereference in dout
  rbd: fix buffer size for writes to images with snapshots
  libceph: use pg_num_mask instead of pgp_num_mask for pg.seed calc
  rbd: fix I/O error propagation for reads
  ceph: use vfs __set_page_dirty_nobuffers interface instead of doing it inside filesystem
  ceph: allow sync_read/write return partial successed size of read/write.
  ceph: fix bugs about handling short-read for sync read mode.
  ceph: remove useless variable revoked_rdcache
  ...

1  2 
drivers/block/rbd.c
net/ceph/messenger.c

diff --combined drivers/block/rbd.c
@@@ -397,19 -397,15 +397,19 @@@ static ssize_t rbd_remove(struct bus_ty
  static int rbd_dev_image_probe(struct rbd_device *rbd_dev, bool mapping);
  static void rbd_spec_put(struct rbd_spec *spec);
  
 -static struct bus_attribute rbd_bus_attrs[] = {
 -      __ATTR(add, S_IWUSR, NULL, rbd_add),
 -      __ATTR(remove, S_IWUSR, NULL, rbd_remove),
 -      __ATTR_NULL
 +static BUS_ATTR(add, S_IWUSR, NULL, rbd_add);
 +static BUS_ATTR(remove, S_IWUSR, NULL, rbd_remove);
 +
 +static struct attribute *rbd_bus_attrs[] = {
 +      &bus_attr_add.attr,
 +      &bus_attr_remove.attr,
 +      NULL,
  };
 +ATTRIBUTE_GROUPS(rbd_bus);
  
  static struct bus_type rbd_bus_type = {
        .name           = "rbd",
 -      .bus_attrs      = rbd_bus_attrs,
 +      .bus_groups     = rbd_bus_groups,
  };
  
  static void rbd_root_dev_release(struct device *dev)
@@@ -1561,11 -1557,12 +1561,12 @@@ rbd_img_obj_request_read_callback(struc
                obj_request, obj_request->img_request, obj_request->result,
                xferred, length);
        /*
-        * ENOENT means a hole in the image.  We zero-fill the
-        * entire length of the request.  A short read also implies
-        * zero-fill to the end of the request.  Either way we
-        * update the xferred count to indicate the whole request
-        * was satisfied.
+        * ENOENT means a hole in the image.  We zero-fill the entire
+        * length of the request.  A short read also implies zero-fill
+        * to the end of the request.  An error requires the whole
+        * length of the request to be reported finished with an error
+        * to the block layer.  In each case we update the xferred
+        * count to indicate the whole request was satisfied.
         */
        rbd_assert(obj_request->type != OBJ_REQUEST_NODATA);
        if (obj_request->result == -ENOENT) {
                else
                        zero_pages(obj_request->pages, 0, length);
                obj_request->result = 0;
-               obj_request->xferred = length;
        } else if (xferred < length && !obj_request->result) {
                if (obj_request->type == OBJ_REQUEST_BIO)
                        zero_bio_chain(obj_request->bio_list, xferred);
                else
                        zero_pages(obj_request->pages, xferred, length);
-               obj_request->xferred = length;
        }
+       obj_request->xferred = length;
        obj_request_done_set(obj_request);
  }
  
@@@ -2167,9 -2163,9 +2167,9 @@@ static int rbd_img_request_fill(struct 
        struct rbd_obj_request *obj_request = NULL;
        struct rbd_obj_request *next_obj_request;
        bool write_request = img_request_write_test(img_request);
-       struct bio *bio_list = 0;
+       struct bio *bio_list = NULL;
        unsigned int bio_offset = 0;
-       struct page **pages = 0;
+       struct page **pages = NULL;
        u64 img_offset;
        u64 resid;
        u16 opcode;
                rbd_segment_name_free(object_name);
                if (!obj_request)
                        goto out_unwind;
+               /*
+                * set obj_request->img_request before creating the
+                * osd_request so that it gets the right snapc
+                */
+               rbd_img_obj_request_add(img_request, obj_request);
  
                if (type == OBJ_REQUEST_BIO) {
                        unsigned int clone_size;
                                        obj_request->pages, length,
                                        offset & ~PAGE_MASK, false, false);
  
-               /*
-                * set obj_request->img_request before formatting
-                * the osd_request so that it gets the right snapc
-                */
-               rbd_img_obj_request_add(img_request, obj_request);
                if (write_request)
                        rbd_osd_req_format_write(obj_request);
                else
@@@ -3706,12 -3702,14 +3706,14 @@@ static int _rbd_dev_v2_snap_size(struc
        if (ret < sizeof (size_buf))
                return -ERANGE;
  
-       if (order)
+       if (order) {
                *order = size_buf.order;
+               dout("  order %u", (unsigned int)*order);
+       }
        *snap_size = le64_to_cpu(size_buf.size);
  
-       dout("  snap_id 0x%016llx order = %u, snap_size = %llu\n",
-               (unsigned long long)snap_id, (unsigned int)*order,
+       dout("  snap_id 0x%016llx snap_size = %llu\n",
+               (unsigned long long)snap_id,
                (unsigned long long)*snap_size);
  
        return 0;
diff --combined net/ceph/messenger.c
@@@ -290,7 -290,7 +290,7 @@@ int ceph_msgr_init(void
        if (ceph_msgr_slab_init())
                return -ENOMEM;
  
-       ceph_msgr_wq = alloc_workqueue("ceph-msgr", WQ_NON_REENTRANT, 0);
+       ceph_msgr_wq = alloc_workqueue("ceph-msgr", 0, 0);
        if (ceph_msgr_wq)
                return 0;
  
@@@ -409,7 -409,7 +409,7 @@@ static void ceph_sock_write_space(struc
         * and net/core/stream.c:sk_stream_write_space().
         */
        if (con_flag_test(con, CON_FLAG_WRITE_PENDING)) {
 -              if (sk_stream_wspace(sk) >= sk_stream_min_wspace(sk)) {
 +              if (sk_stream_is_writeable(sk)) {
                        dout("%s %p queueing write work\n", __func__, con);
                        clear_bit(SOCK_NOSPACE, &sk->sk_socket->flags);
                        queue_con(con);