Whamcloud - gitweb
LU-13799 llite: Adjust dio refcounting
[fs/lustre-release.git] / lustre / obdecho / echo_client.c
index 92c923d..4042fe5 100644 (file)
@@ -27,7 +27,6 @@
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
  */
 
 #define DEBUG_SUBSYSTEM S_ECHO
@@ -1329,7 +1328,7 @@ static void echo_commit_callback(const struct lu_env *env, struct cl_io *io,
                struct page *vmpage = pvec->pages[i];
                struct cl_page *page = (struct cl_page *)vmpage->private;
 
-               cl_page_list_add(&queue->c2_qout, page);
+               cl_page_list_add(&queue->c2_qout, page, true);
        }
 }
 
@@ -1392,7 +1391,7 @@ static int cl_echo_object_brw(struct echo_object *eco, int rw, u64 offset,
                        break;
                }
 
-               cl_2queue_add(queue, clp);
+               cl_2queue_add(queue, clp, true);
 
                /*
                 * drop the reference count for cl_page_find, so that the page
@@ -2246,6 +2245,7 @@ static struct lu_object *echo_resolve_path(const struct lu_env *env,
 static void echo_ucred_init(struct lu_env *env)
 {
        struct lu_ucred *ucred = lu_ucred(env);
+       kernel_cap_t kcap = current_cap();
 
        ucred->uc_valid = UCRED_INVALID;
 
@@ -2263,8 +2263,11 @@ static void echo_ucred_init(struct lu_env *env)
        ucred->uc_cap = cfs_curproc_cap_pack();
 
        /* remove fs privilege for non-root user. */
-       if (ucred->uc_fsuid)
-               ucred->uc_cap &= ~CFS_CAP_FS_MASK;
+       if (ucred->uc_fsuid) {
+               kcap = cap_drop_nfsd_set(kcap);
+               kcap = cap_drop_fs_set(kcap);
+       }
+       ucred->uc_cap = kcap.cap[0];
        ucred->uc_valid = UCRED_NEW;
 }
 
@@ -2572,13 +2575,13 @@ static int echo_client_kbrw(struct echo_device *ed, int rw, struct obdo *oa,
        if (rw == OBD_BRW_WRITE)
                brw_flags = OBD_BRW_ASYNC;
 
-       OBD_ALLOC_PTR_ARRAY(pga, npages);
+       OBD_ALLOC_PTR_ARRAY_LARGE(pga, npages);
        if (!pga)
                RETURN(-ENOMEM);
 
-       OBD_ALLOC_PTR_ARRAY(pages, npages);
+       OBD_ALLOC_PTR_ARRAY_LARGE(pages, npages);
        if (!pages) {
-               OBD_FREE_PTR_ARRAY(pga, npages);
+               OBD_FREE_PTR_ARRAY_LARGE(pga, npages);
                RETURN(-ENOMEM);
        }
 
@@ -2630,8 +2633,8 @@ static int echo_client_kbrw(struct echo_device *ed, int rw, struct obdo *oa,
                }
                __free_page(pgp->pg);
        }
-       OBD_FREE_PTR_ARRAY(pga, npages);
-       OBD_FREE_PTR_ARRAY(pages, npages);
+       OBD_FREE_PTR_ARRAY_LARGE(pga, npages);
+       OBD_FREE_PTR_ARRAY_LARGE(pages, npages);
        RETURN(rc);
 }
 
@@ -2841,7 +2844,7 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
 
        switch (cmd) {
        case OBD_IOC_CREATE:                    /* may create echo object */
-               if (!cfs_capable(CAP_SYS_ADMIN))
+               if (!capable(CAP_SYS_ADMIN))
                        GOTO(out, rc = -EPERM);
 
                rc = echo_create_object(env, ed, oa);
@@ -2855,7 +2858,7 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
                int dirlen;
                __u64 id;
 
-               if (!cfs_capable(CAP_SYS_ADMIN))
+               if (!capable(CAP_SYS_ADMIN))
                        GOTO(out, rc = -EPERM);
 
                count = data->ioc_count;
@@ -2880,7 +2883,7 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
                __u64            seq;
                int              max_count;
 
-               if (!cfs_capable(CAP_SYS_ADMIN))
+               if (!capable(CAP_SYS_ADMIN))
                        GOTO(out, rc = -EPERM);
 
                rc = seq_client_get_seq(env, ed->ed_cl_seq, &seq);
@@ -2901,7 +2904,7 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
        }
 #endif /* HAVE_SERVER_SUPPORT */
        case OBD_IOC_DESTROY:
-               if (!cfs_capable(CAP_SYS_ADMIN))
+               if (!capable(CAP_SYS_ADMIN))
                        GOTO(out, rc = -EPERM);
 
                rc = echo_get_object(&eco, ed, oa);
@@ -2922,7 +2925,7 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
                GOTO(out, rc);
 
        case OBD_IOC_SETATTR:
-               if (!cfs_capable(CAP_SYS_ADMIN))
+               if (!capable(CAP_SYS_ADMIN))
                        GOTO(out, rc = -EPERM);
 
                rc = echo_get_object(&eco, ed, oa);
@@ -2933,7 +2936,7 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
                GOTO(out, rc);
 
        case OBD_IOC_BRW_WRITE:
-               if (!cfs_capable(CAP_SYS_ADMIN))
+               if (!capable(CAP_SYS_ADMIN))
                        GOTO(out, rc = -EPERM);
 
                rw = OBD_BRW_WRITE;
@@ -3006,7 +3009,9 @@ static int echo_client_setup(const struct lu_env *env,
                                 OBD_CONNECT_BRW_SIZE |
                                 OBD_CONNECT_GRANT | OBD_CONNECT_FULL20 |
                                 OBD_CONNECT_64BITHASH | OBD_CONNECT_LVB_TYPE |
-                                OBD_CONNECT_FID;
+                                OBD_CONNECT_FID | OBD_CONNECT_FLAGS2;
+       ocd->ocd_connect_flags2 = OBD_CONNECT2_REP_MBITS;
+
        ocd->ocd_brw_size = DT_MAX_BRW_SIZE;
        ocd->ocd_version = LUSTRE_VERSION_CODE;
        ocd->ocd_group = FID_SEQ_ECHO;