]> Git Repo - linux.git/commitdiff
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph...
authorLinus Torvalds <[email protected]>
Fri, 1 Mar 2013 01:43:09 +0000 (17:43 -0800)
committerLinus Torvalds <[email protected]>
Fri, 1 Mar 2013 01:43:09 +0000 (17:43 -0800)
Pull Ceph updates from Sage Weil:
 "A few groups of patches here.  Alex has been hard at work improving
  the RBD code, layout groundwork for understanding the new formats and
  doing layering.  Most of the infrastructure is now in place for the
  final bits that will come with the next window.

  There are a few changes to the data layout.  Jim Schutt's patch fixes
  some non-ideal CRUSH behavior, and a set of patches from me updates
  the client to speak a newer version of the protocol and implement an
  improved hashing strategy across storage nodes (when the server side
  supports it too).

  A pair of patches from Sam Lang fix the atomicity of open+create
  operations.  Several patches from Yan, Zheng fix various mds/client
  issues that turned up during multi-mds torture tests.

  A final set of patches expose file layouts via virtual xattrs, and
  allow the policies to be set on directories via xattrs as well
  (avoiding the awkward ioctl interface and providing a consistent
  interface for both kernel mount and ceph-fuse users)."

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client: (143 commits)
  libceph: add support for HASHPSPOOL pool flag
  libceph: update osd request/reply encoding
  libceph: calculate placement based on the internal data types
  ceph: update support for PGID64, PGPOOL3, OSDENC protocol features
  ceph: update "ceph_features.h"
  libceph: decode into cpu-native ceph_pg type
  libceph: rename ceph_pg -> ceph_pg_v1
  rbd: pass length, not op for osd completions
  rbd: move rbd_osd_trivial_callback()
  libceph: use a do..while loop in con_work()
  libceph: use a flag to indicate a fault has occurred
  libceph: separate non-locked fault handling
  libceph: encapsulate connection backoff
  libceph: eliminate sparse warnings
  ceph: eliminate sparse warnings in fs code
  rbd: eliminate sparse warnings
  libceph: define connection flag helpers
  rbd: normalize dout() calls
  rbd: barriers are hard
  rbd: ignore zero-length requests
  ...

1  2 
fs/ceph/addr.c
fs/ceph/caps.c
fs/ceph/file.c
fs/ceph/ioctl.c
fs/ceph/mds_client.c
fs/ceph/mds_client.h
fs/ceph/super.h
net/ceph/ceph_common.c

diff --combined fs/ceph/addr.c
index d4f81edd9a5d8d4d57152411b1a896528b333446,cfef3e01a9b3a4b1816de96a930984bf7d32c142..a60ea977af6fa4c4ac65cea398dd04964e7d15e7
@@@ -195,7 -195,7 +195,7 @@@ static int ceph_releasepage(struct pag
   */
  static int readpage_nounlock(struct file *filp, struct page *page)
  {
 -      struct inode *inode = filp->f_dentry->d_inode;
 +      struct inode *inode = file_inode(filp);
        struct ceph_inode_info *ci = ceph_inode(inode);
        struct ceph_osd_client *osdc = 
                &ceph_inode_to_client(inode)->client->osdc;
@@@ -236,16 -236,10 +236,10 @@@ static int ceph_readpage(struct file *f
  static void finish_read(struct ceph_osd_request *req, struct ceph_msg *msg)
  {
        struct inode *inode = req->r_inode;
-       struct ceph_osd_reply_head *replyhead;
-       int rc, bytes;
+       int rc = req->r_result;
+       int bytes = le32_to_cpu(msg->hdr.data_len);
        int i;
  
-       /* parse reply */
-       replyhead = msg->front.iov_base;
-       WARN_ON(le32_to_cpu(replyhead->num_ops) == 0);
-       rc = le32_to_cpu(replyhead->result);
-       bytes = le32_to_cpu(msg->hdr.data_len);
        dout("finish_read %p req %p rc %d bytes %d\n", inode, req, rc, bytes);
  
        /* unlock all pages, zeroing any data we didn't read */
@@@ -315,7 -309,7 +309,7 @@@ static int start_read(struct inode *ino
                                    CEPH_OSD_OP_READ, CEPH_OSD_FLAG_READ,
                                    NULL, 0,
                                    ci->i_truncate_seq, ci->i_truncate_size,
-                                   NULL, false, 1, 0);
+                                   NULL, false, 0);
        if (IS_ERR(req))
                return PTR_ERR(req);
  
@@@ -370,7 -364,7 +364,7 @@@ out
  static int ceph_readpages(struct file *file, struct address_space *mapping,
                          struct list_head *page_list, unsigned nr_pages)
  {
 -      struct inode *inode = file->f_dentry->d_inode;
 +      struct inode *inode = file_inode(file);
        struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
        int rc = 0;
        int max = 0;
@@@ -492,8 -486,7 +486,7 @@@ static int writepage_nounlock(struct pa
                                   &ci->i_layout, snapc,
                                   page_off, len,
                                   ci->i_truncate_seq, ci->i_truncate_size,
-                                  &inode->i_mtime,
-                                  &page, 1, 0, 0, true);
+                                  &inode->i_mtime, &page, 1);
        if (err < 0) {
                dout("writepage setting page/mapping error %d %p\n", err, page);
                SetPageError(page);
@@@ -554,27 -547,18 +547,18 @@@ static void writepages_finish(struct ce
                              struct ceph_msg *msg)
  {
        struct inode *inode = req->r_inode;
-       struct ceph_osd_reply_head *replyhead;
-       struct ceph_osd_op *op;
        struct ceph_inode_info *ci = ceph_inode(inode);
        unsigned wrote;
        struct page *page;
        int i;
        struct ceph_snap_context *snapc = req->r_snapc;
        struct address_space *mapping = inode->i_mapping;
-       __s32 rc = -EIO;
-       u64 bytes = 0;
+       int rc = req->r_result;
+       u64 bytes = le64_to_cpu(req->r_request_ops[0].extent.length);
        struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
        long writeback_stat;
        unsigned issued = ceph_caps_issued(ci);
  
-       /* parse reply */
-       replyhead = msg->front.iov_base;
-       WARN_ON(le32_to_cpu(replyhead->num_ops) == 0);
-       op = (void *)(replyhead + 1);
-       rc = le32_to_cpu(replyhead->result);
-       bytes = le64_to_cpu(op->extent.length);
        if (rc >= 0) {
                /*
                 * Assume we wrote the pages we originally sent.  The
@@@ -741,8 -725,6 +725,6 @@@ retry
                struct page *page;
                int want;
                u64 offset, len;
-               struct ceph_osd_request_head *reqhead;
-               struct ceph_osd_op *op;
                long writeback_stat;
  
                next = 0;
@@@ -838,7 -820,7 +820,7 @@@ get_more_pages
                                            snapc, do_sync,
                                            ci->i_truncate_seq,
                                            ci->i_truncate_size,
-                                           &inode->i_mtime, true, 1, 0);
+                                           &inode->i_mtime, true, 0);
  
                                if (IS_ERR(req)) {
                                        rc = PTR_ERR(req);
  
                /* revise final length, page count */
                req->r_num_pages = locked_pages;
-               reqhead = req->r_request->front.iov_base;
-               op = (void *)(reqhead + 1);
-               op->extent.length = cpu_to_le64(len);
-               op->payload_len = cpu_to_le32(len);
+               req->r_request_ops[0].extent.length = cpu_to_le64(len);
+               req->r_request_ops[0].payload_len = cpu_to_le32(len);
                req->r_request->hdr.data_len = cpu_to_le32(len);
  
                rc = ceph_osdc_start_request(&fsc->client->osdc, req, true);
@@@ -977,7 -957,7 +957,7 @@@ static int ceph_update_writeable_page(s
                            loff_t pos, unsigned len,
                            struct page *page)
  {
 -      struct inode *inode = file->f_dentry->d_inode;
 +      struct inode *inode = file_inode(file);
        struct ceph_inode_info *ci = ceph_inode(inode);
        struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc;
        loff_t page_off = pos & PAGE_CACHE_MASK;
@@@ -1086,7 -1066,7 +1066,7 @@@ static int ceph_write_begin(struct fil
                            loff_t pos, unsigned len, unsigned flags,
                            struct page **pagep, void **fsdata)
  {
 -      struct inode *inode = file->f_dentry->d_inode;
 +      struct inode *inode = file_inode(file);
        struct ceph_inode_info *ci = ceph_inode(inode);
        struct ceph_file_info *fi = file->private_data;
        struct page *page;
@@@ -1144,7 -1124,7 +1124,7 @@@ static int ceph_write_end(struct file *
                          loff_t pos, unsigned len, unsigned copied,
                          struct page *page, void *fsdata)
  {
 -      struct inode *inode = file->f_dentry->d_inode;
 +      struct inode *inode = file_inode(file);
        struct ceph_inode_info *ci = ceph_inode(inode);
        struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
        struct ceph_mds_client *mdsc = fsc->mdsc;
@@@ -1228,7 -1208,7 +1208,7 @@@ const struct address_space_operations c
   */
  static int ceph_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
  {
 -      struct inode *inode = vma->vm_file->f_dentry->d_inode;
 +      struct inode *inode = file_inode(vma->vm_file);
        struct page *page = vmf->page;
        struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc;
        loff_t off = page_offset(page);
diff --combined fs/ceph/caps.c
index ae2be696eb5b32e5e2cbad2a591582c3d802aab5,1e1e02055a2b5370b375bd29b9138cf6798b81a6..78e2f575247dce25ebbfdef971ac8f458531442c
@@@ -611,8 -611,16 +611,16 @@@ retry
  
        if (flags & CEPH_CAP_FLAG_AUTH)
                ci->i_auth_cap = cap;
-       else if (ci->i_auth_cap == cap)
+       else if (ci->i_auth_cap == cap) {
                ci->i_auth_cap = NULL;
+               spin_lock(&mdsc->cap_dirty_lock);
+               if (!list_empty(&ci->i_dirty_item)) {
+                       dout(" moving %p to cap_dirty_migrating\n", inode);
+                       list_move(&ci->i_dirty_item,
+                                 &mdsc->cap_dirty_migrating);
+               }
+               spin_unlock(&mdsc->cap_dirty_lock);
+       }
  
        dout("add_cap inode %p (%llx.%llx) cap %p %s now %s seq %d mds%d\n",
             inode, ceph_vinop(inode), cap, ceph_cap_string(issued),
@@@ -930,7 -938,7 +938,7 @@@ static int send_cap_msg(struct ceph_mds
                        u64 size, u64 max_size,
                        struct timespec *mtime, struct timespec *atime,
                        u64 time_warp_seq,
 -                      uid_t uid, gid_t gid, umode_t mode,
 +                      kuid_t uid, kgid_t gid, umode_t mode,
                        u64 xattr_version,
                        struct ceph_buffer *xattrs_buf,
                        u64 follows)
                ceph_encode_timespec(&fc->atime, atime);
        fc->time_warp_seq = cpu_to_le32(time_warp_seq);
  
 -      fc->uid = cpu_to_le32(uid);
 -      fc->gid = cpu_to_le32(gid);
 +      fc->uid = cpu_to_le32(from_kuid(&init_user_ns, uid));
 +      fc->gid = cpu_to_le32(from_kgid(&init_user_ns, gid));
        fc->mode = cpu_to_le32(mode);
  
        fc->xattr_version = cpu_to_le64(xattr_version);
@@@ -1081,8 -1089,8 +1089,8 @@@ static int __send_cap(struct ceph_mds_c
        struct timespec mtime, atime;
        int wake = 0;
        umode_t mode;
 -      uid_t uid;
 -      gid_t gid;
 +      kuid_t uid;
 +      kgid_t gid;
        struct ceph_mds_session *session;
        u64 xattr_version = 0;
        struct ceph_buffer *xattr_blob = NULL;
@@@ -1460,7 -1468,7 +1468,7 @@@ void ceph_check_caps(struct ceph_inode_
        struct ceph_mds_client *mdsc = fsc->mdsc;
        struct inode *inode = &ci->vfs_inode;
        struct ceph_cap *cap;
-       int file_wanted, used;
+       int file_wanted, used, cap_used;
        int took_snap_rwsem = 0;             /* true if mdsc->snap_rwsem held */
        int issued, implemented, want, retain, revoking, flushing = 0;
        int mds = -1;   /* keep track of how far we've gone through i_caps list
@@@ -1563,9 -1571,14 +1571,14 @@@ retry_locked
  
                /* NOTE: no side-effects allowed, until we take s_mutex */
  
+               cap_used = used;
+               if (ci->i_auth_cap && cap != ci->i_auth_cap)
+                       cap_used &= ~ci->i_auth_cap->issued;
                revoking = cap->implemented & ~cap->issued;
-               dout(" mds%d cap %p issued %s implemented %s revoking %s\n",
+               dout(" mds%d cap %p used %s issued %s implemented %s revoking %s\n",
                     cap->mds, cap, ceph_cap_string(cap->issued),
+                    ceph_cap_string(cap_used),
                     ceph_cap_string(cap->implemented),
                     ceph_cap_string(revoking));
  
                }
  
                /* completed revocation? going down and there are no caps? */
-               if (revoking && (revoking & used) == 0) {
+               if (revoking && (revoking & cap_used) == 0) {
                        dout("completed revocation of %s\n",
                             ceph_cap_string(cap->implemented & ~cap->issued));
                        goto ack;
@@@ -1670,8 -1683,8 +1683,8 @@@ ack
                sent++;
  
                /* __send_cap drops i_ceph_lock */
-               delayed += __send_cap(mdsc, cap, CEPH_CAP_OP_UPDATE, used, want,
-                                     retain, flushing, NULL);
+               delayed += __send_cap(mdsc, cap, CEPH_CAP_OP_UPDATE, cap_used,
+                                     want, retain, flushing, NULL);
                goto retry; /* retake i_ceph_lock and restart our cap scan. */
        }
  
@@@ -2359,11 -2372,10 +2372,11 @@@ static void handle_cap_grant(struct ino
  
        if ((issued & CEPH_CAP_AUTH_EXCL) == 0) {
                inode->i_mode = le32_to_cpu(grant->mode);
 -              inode->i_uid = le32_to_cpu(grant->uid);
 -              inode->i_gid = le32_to_cpu(grant->gid);
 +              inode->i_uid = make_kuid(&init_user_ns, le32_to_cpu(grant->uid));
 +              inode->i_gid = make_kgid(&init_user_ns, le32_to_cpu(grant->gid));
                dout("%p mode 0%o uid.gid %d.%d\n", inode, inode->i_mode,
 -                   inode->i_uid, inode->i_gid);
 +                   from_kuid(&init_user_ns, inode->i_uid),
 +                   from_kgid(&init_user_ns, inode->i_gid));
        }
  
        if ((issued & CEPH_CAP_LINK_EXCL) == 0)
                dout("mds wanted %s -> %s\n",
                     ceph_cap_string(le32_to_cpu(grant->wanted)),
                     ceph_cap_string(wanted));
-               grant->wanted = cpu_to_le32(wanted);
+               /* imported cap may not have correct mds_wanted */
+               if (le32_to_cpu(grant->op) == CEPH_CAP_OP_IMPORT)
+                       check_caps = 1;
        }
  
        cap->seq = seq;
@@@ -2821,6 -2835,9 +2836,9 @@@ void ceph_handle_caps(struct ceph_mds_s
        dout(" mds%d seq %lld cap seq %u\n", session->s_mds, session->s_seq,
             (unsigned)seq);
  
+       if (op == CEPH_CAP_OP_IMPORT)
+               ceph_add_cap_releases(mdsc, session);
        /* lookup ino */
        inode = ceph_find_inode(sb, vino);
        ci = ceph_inode(inode);
diff --combined fs/ceph/file.c
index 11b57c2c8f154871da4f9e51c90083ae000e46c1,9c4325e654ca2dc6bfddcd5d99b88e749b0c8c7e..bf338d9b67e30b04927814016f58fa9334e12ac9
@@@ -243,6 -243,9 +243,9 @@@ int ceph_atomic_open(struct inode *dir
        err = ceph_mdsc_do_request(mdsc,
                                   (flags & (O_CREAT|O_TRUNC)) ? dir : NULL,
                                   req);
+       if (err)
+               goto out_err;
        err = ceph_handle_snapdir(req, dentry, err);
        if (err == 0 && (flags & O_CREAT) && !req->r_reply_info.head->is_dentry)
                err = ceph_handle_notrace_create(dir, dentry);
                err = finish_no_open(file, dn);
        } else {
                dout("atomic_open finish_open on dn %p\n", dn);
+               if (req->r_op == CEPH_MDS_OP_CREATE && req->r_reply_info.has_create_ino) {
+                       *opened |= FILE_CREATED;
+               }
                err = finish_open(file, dentry, ceph_open, opened);
        }
  
@@@ -393,7 -399,7 +399,7 @@@ more
  static ssize_t ceph_sync_read(struct file *file, char __user *data,
                              unsigned len, loff_t *poff, int *checkeof)
  {
 -      struct inode *inode = file->f_dentry->d_inode;
 +      struct inode *inode = file_inode(file);
        struct page **pages;
        u64 off = *poff;
        int num_pages, ret;
@@@ -466,7 -472,7 +472,7 @@@ static void sync_write_commit(struct ce
  static ssize_t ceph_sync_write(struct file *file, const char __user *data,
                               size_t left, loff_t *offset)
  {
 -      struct inode *inode = file->f_dentry->d_inode;
 +      struct inode *inode = file_inode(file);
        struct ceph_inode_info *ci = ceph_inode(inode);
        struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
        struct ceph_osd_request *req;
        int ret;
        struct timespec mtime = CURRENT_TIME;
  
 -      if (ceph_snap(file->f_dentry->d_inode) != CEPH_NOSNAP)
 +      if (ceph_snap(file_inode(file)) != CEPH_NOSNAP)
                return -EROFS;
  
        dout("sync_write on file %p %lld~%u %s\n", file, *offset,
@@@ -535,7 -541,7 +541,7 @@@ more
                                    ci->i_snap_realm->cached_context,
                                    do_sync,
                                    ci->i_truncate_seq, ci->i_truncate_size,
-                                   &mtime, false, 2, page_align);
+                                   &mtime, false, page_align);
        if (IS_ERR(req))
                return PTR_ERR(req);
  
@@@ -637,7 -643,7 +643,7 @@@ static ssize_t ceph_aio_read(struct kio
        struct ceph_file_info *fi = filp->private_data;
        loff_t *ppos = &iocb->ki_pos;
        size_t len = iov->iov_len;
 -      struct inode *inode = filp->f_dentry->d_inode;
 +      struct inode *inode = file_inode(filp);
        struct ceph_inode_info *ci = ceph_inode(inode);
        void __user *base = iov->iov_base;
        ssize_t ret;
@@@ -707,7 -713,7 +713,7 @@@ static ssize_t ceph_aio_write(struct ki
  {
        struct file *file = iocb->ki_filp;
        struct ceph_file_info *fi = file->private_data;
 -      struct inode *inode = file->f_dentry->d_inode;
 +      struct inode *inode = file_inode(file);
        struct ceph_inode_info *ci = ceph_inode(inode);
        struct ceph_osd_client *osdc =
                &ceph_sb_to_client(inode->i_sb)->client->osdc;
diff --combined fs/ceph/ioctl.c
index f5ed767806df2ea39082ffa5b892025dc6dbc218,7d85991fd6473f79beb2e2176232aa9856654d22..4a989345b37bd368e62ede9ddc0032ff8e5b8fa4
   */
  static long ceph_ioctl_get_layout(struct file *file, void __user *arg)
  {
 -      struct ceph_inode_info *ci = ceph_inode(file->f_dentry->d_inode);
 +      struct ceph_inode_info *ci = ceph_inode(file_inode(file));
        struct ceph_ioctl_layout l;
        int err;
  
 -      err = ceph_do_getattr(file->f_dentry->d_inode, CEPH_STAT_CAP_LAYOUT);
 +      err = ceph_do_getattr(file_inode(file), CEPH_STAT_CAP_LAYOUT);
        if (!err) {
                l.stripe_unit = ceph_file_layout_su(ci->i_layout);
                l.stripe_count = ceph_file_layout_stripe_count(ci->i_layout);
@@@ -63,12 -63,12 +63,12 @@@ static long __validate_layout(struct ce
  
  static long ceph_ioctl_set_layout(struct file *file, void __user *arg)
  {
 -      struct inode *inode = file->f_dentry->d_inode;
 +      struct inode *inode = file_inode(file);
        struct inode *parent_inode;
        struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
        struct ceph_mds_request *req;
        struct ceph_ioctl_layout l;
 -      struct ceph_inode_info *ci = ceph_inode(file->f_dentry->d_inode);
 +      struct ceph_inode_info *ci = ceph_inode(file_inode(file));
        struct ceph_ioctl_layout nl;
        int err;
  
@@@ -76,7 -76,7 +76,7 @@@
                return -EFAULT;
  
        /* validate changed params against current layout */
 -      err = ceph_do_getattr(file->f_dentry->d_inode, CEPH_STAT_CAP_LAYOUT);
 +      err = ceph_do_getattr(file_inode(file), CEPH_STAT_CAP_LAYOUT);
        if (err)
                return err;
  
   */
  static long ceph_ioctl_set_layout_policy (struct file *file, void __user *arg)
  {
 -      struct inode *inode = file->f_dentry->d_inode;
 +      struct inode *inode = file_inode(file);
        struct ceph_mds_request *req;
        struct ceph_ioctl_layout l;
        int err;
  static long ceph_ioctl_get_dataloc(struct file *file, void __user *arg)
  {
        struct ceph_ioctl_dataloc dl;
 -      struct inode *inode = file->f_dentry->d_inode;
 +      struct inode *inode = file_inode(file);
        struct ceph_inode_info *ci = ceph_inode(inode);
        struct ceph_osd_client *osdc =
                &ceph_sb_to_client(inode->i_sb)->client->osdc;
        u64 len = 1, olen;
        u64 tmp;
-       struct ceph_object_layout ol;
        struct ceph_pg pgid;
        int r;
  
                return -EFAULT;
  
        down_read(&osdc->map_sem);
-       r = ceph_calc_file_object_mapping(&ci->i_layout, dl.file_offset, &len,
+       r = ceph_calc_file_object_mapping(&ci->i_layout, dl.file_offset, len,
                                          &dl.object_no, &dl.object_offset,
                                          &olen);
        if (r < 0)
  
        snprintf(dl.object_name, sizeof(dl.object_name), "%llx.%08llx",
                 ceph_ino(inode), dl.object_no);
-       ceph_calc_object_layout(&ol, dl.object_name, &ci->i_layout,
+       ceph_calc_object_layout(&pgid, dl.object_name, &ci->i_layout,
                                osdc->osdmap);
  
-       pgid = ol.ol_pgid;
        dl.osd = ceph_calc_pg_primary(osdc->osdmap, pgid);
        if (dl.osd >= 0) {
                struct ceph_entity_addr *a =
  static long ceph_ioctl_lazyio(struct file *file)
  {
        struct ceph_file_info *fi = file->private_data;
 -      struct inode *inode = file->f_dentry->d_inode;
 +      struct inode *inode = file_inode(file);
        struct ceph_inode_info *ci = ceph_inode(inode);
  
        if ((fi->fmode & CEPH_FILE_MODE_LAZY) == 0) {
diff --combined fs/ceph/mds_client.c
index 7a3dfe0a9a80e551f905a4d46d1248ea9e6c26f5,d95842036c8b11b570f0c5a998087527d3b351e3..442880d099c939480583b3366eee9142e2d63d89
@@@ -232,6 -232,30 +232,30 @@@ bad
        return -EIO;
  }
  
+ /*
+  * parse create results
+  */
+ static int parse_reply_info_create(void **p, void *end,
+                                 struct ceph_mds_reply_info_parsed *info,
+                                 int features)
+ {
+       if (features & CEPH_FEATURE_REPLY_CREATE_INODE) {
+               if (*p == end) {
+                       info->has_create_ino = false;
+               } else {
+                       info->has_create_ino = true;
+                       info->ino = ceph_decode_64(p);
+               }
+       }
+       if (unlikely(*p != end))
+               goto bad;
+       return 0;
+ bad:
+       return -EIO;
+ }
  /*
   * parse extra results
   */
@@@ -241,8 -265,12 +265,12 @@@ static int parse_reply_info_extra(void 
  {
        if (info->head->op == CEPH_MDS_OP_GETFILELOCK)
                return parse_reply_info_filelock(p, end, info, features);
-       else
+       else if (info->head->op == CEPH_MDS_OP_READDIR)
                return parse_reply_info_dir(p, end, info, features);
+       else if (info->head->op == CEPH_MDS_OP_CREATE)
+               return parse_reply_info_create(p, end, info, features);
+       else
+               return -EIO;
  }
  
  /*
@@@ -1658,8 -1686,8 +1686,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(req->r_uid);
 -      head->caller_gid = cpu_to_le32(req->r_gid);
 +      head->caller_uid = cpu_to_le32(from_kuid(&init_user_ns, req->r_uid));
 +      head->caller_gid = cpu_to_le32(from_kgid(&init_user_ns, req->r_gid));
        head->args = req->r_args;
  
        ceph_encode_filepath(&p, end, ino1, path1);
@@@ -2170,7 -2198,8 +2198,8 @@@ static void handle_reply(struct ceph_md
        mutex_lock(&req->r_fill_mutex);
        err = ceph_fill_trace(mdsc->fsc->sb, req, req->r_session);
        if (err == 0) {
-               if (result == 0 && req->r_op != CEPH_MDS_OP_GETFILELOCK &&
+               if (result == 0 && (req->r_op == CEPH_MDS_OP_READDIR ||
+                                   req->r_op == CEPH_MDS_OP_LSSNAP) &&
                    rinfo->dir_nr)
                        ceph_readdir_prepopulate(req, req->r_session);
                ceph_unreserve_caps(mdsc, &req->r_caps_reservation);
diff --combined fs/ceph/mds_client.h
index ff4188bf6199b5988d9ba7c111160b3f0aadbd67,567f7c60354e916fe5b34679d53313a361c2b08d..c2a19fbbe5177b619b7a3d7e6132b626df8c8508
@@@ -74,6 -74,12 +74,12 @@@ struct ceph_mds_reply_info_parsed 
                        struct ceph_mds_reply_info_in *dir_in;
                        u8                            dir_complete, dir_end;
                };
+               /* for create results */
+               struct {
+                       bool has_create_ino;
+                       u64 ino;
+               };
        };
  
        /* encoded blob describing snapshot contexts for certain
@@@ -184,8 -190,8 +190,8 @@@ struct ceph_mds_request 
  
        union ceph_mds_request_args r_args;
        int r_fmode;        /* file mode, if expecting cap */
 -      uid_t r_uid;
 -      gid_t r_gid;
 +      kuid_t r_uid;
 +      kgid_t r_gid;
  
        /* for choosing which mds to send this request to */
        int r_direct_mode;
diff --combined fs/ceph/super.h
index f053bbd1886f215b2e2c64dab12f0a1812b5808e,604526a0d6cd441b880d6dbd3d01627970a8810a..c7b309723dcc2ee1db835db6395b42d36b461fe6
@@@ -21,7 -21,7 +21,7 @@@
  
  /* large granularity for statfs utilization stats to facilitate
   * large volume sizes on 32-bit machines. */
- #define CEPH_BLOCK_SHIFT   20  /* 1 MB */
+ #define CEPH_BLOCK_SHIFT   22  /* 4 MB */
  #define CEPH_BLOCK         (1 << CEPH_BLOCK_SHIFT)
  
  #define CEPH_MOUNT_OPT_DIRSTAT         (1<<4) /* `cat dirname` for stats */
@@@ -138,8 -138,8 +138,8 @@@ struct ceph_cap_snap 
        struct ceph_snap_context *context;
  
        umode_t mode;
 -      uid_t uid;
 -      gid_t gid;
 +      kuid_t uid;
 +      kgid_t gid;
  
        struct ceph_buffer *xattr_blob;
        u64 xattr_version;
@@@ -798,13 -798,7 +798,7 @@@ extern int ceph_mmap(struct file *file
  /* file.c */
  extern const struct file_operations ceph_file_fops;
  extern const struct address_space_operations ceph_aops;
- extern int ceph_copy_to_page_vector(struct page **pages,
-                                   const char *data,
-                                   loff_t off, size_t len);
- extern int ceph_copy_from_page_vector(struct page **pages,
-                                   char *data,
-                                   loff_t off, size_t len);
- extern struct page **ceph_alloc_page_vector(int num_pages, gfp_t flags);
  extern int ceph_open(struct inode *inode, struct file *file);
  extern int ceph_atomic_open(struct inode *dir, struct dentry *dentry,
                            struct file *file, unsigned flags, umode_t mode,
diff --combined net/ceph/ceph_common.c
index 1deb29af82fd2b10a2b578c4a11c362fa83d4ecf,c5605ae9671448d4a3a72b96339bcb9fcebe7fe8..e65e6e4be38be72cff529e7d5019c908dd8f3961
@@@ -15,8 -15,6 +15,8 @@@
  #include <linux/slab.h>
  #include <linux/statfs.h>
  #include <linux/string.h>
 +#include <linux/nsproxy.h>
 +#include <net/net_namespace.h>
  
  
  #include <linux/ceph/ceph_features.h>
  #include "crypto.h"
  
  
+ /*
+  * Module compatibility interface.  For now it doesn't do anything,
+  * but its existence signals a certain level of functionality.
+  *
+  * The data buffer is used to pass information both to and from
+  * libceph.  The return value indicates whether libceph determines
+  * it is compatible with the caller (from another kernel module),
+  * given the provided data.
+  *
+  * The data pointer can be null.
+  */
+ bool libceph_compatible(void *data)
+ {
+       return true;
+ }
+ EXPORT_SYMBOL(libceph_compatible);
  
  /*
   * find filename portion of a path (/foo/bar/baz -> baz)
@@@ -294,9 -308,6 +310,9 @@@ ceph_parse_options(char *options, cons
        int err = -ENOMEM;
        substring_t argstr[MAX_OPT_ARGS];
  
 +      if (current->nsproxy->net_ns != &init_net)
 +              return ERR_PTR(-EINVAL);
 +
        opt = kzalloc(sizeof(*opt), GFP_KERNEL);
        if (!opt)
                return ERR_PTR(-ENOMEM);
@@@ -590,10 -601,8 +606,8 @@@ static int __init init_ceph_lib(void
        if (ret < 0)
                goto out_crypto;
  
-       pr_info("loaded (mon/osd proto %d/%d, osdmap %d/%d %d/%d)\n",
-               CEPH_MONC_PROTOCOL, CEPH_OSDC_PROTOCOL,
-               CEPH_OSDMAP_VERSION, CEPH_OSDMAP_VERSION_EXT,
-               CEPH_OSDMAP_INC_VERSION, CEPH_OSDMAP_INC_VERSION_EXT);
+       pr_info("loaded (mon/osd proto %d/%d)\n",
+               CEPH_MONC_PROTOCOL, CEPH_OSDC_PROTOCOL);
  
        return 0;
  
This page took 0.103324 seconds and 4 git commands to generate.