X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fmdt%2Fmdt_idmap.c;h=acb9dbb9d6241d777682452cd27e2263b2300583;hb=64af83190180a8f3e90aea270e2baaecb1ecdb93;hp=ad1bdb52dca9ec24e0a1e346a71f9147067ca9ea;hpb=0f8dca08a4f68cba82c2c822998ecc309d3b7aaf;p=fs%2Flustre-release.git diff --git a/lustre/mdt/mdt_idmap.c b/lustre/mdt/mdt_idmap.c index ad1bdb5..acb9dbb 100644 --- a/lustre/mdt/mdt_idmap.c +++ b/lustre/mdt/mdt_idmap.c @@ -1,6 +1,4 @@ -/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- - * vim:expandtab:shiftwidth=8:tabstop=8: - * +/* * GPL HEADER START * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,6 +26,8 @@ /* * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. + * + * Copyright (c) 2012, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ @@ -39,14 +39,8 @@ * Author: Fan Yong */ -#ifndef EXPORT_SYMTAB -#define EXPORT_SYMTAB -#endif #define DEBUG_SUBSYSTEM S_MDS -#ifndef AUTOCONF_INCLUDED -#include -#endif #include #include #include @@ -56,7 +50,6 @@ #include #include #include -#include #include #include #include @@ -64,6 +57,7 @@ #include #include +#include #include #include #include @@ -72,7 +66,6 @@ #include #include #include -#include #include "mdt_internal.h" @@ -82,9 +75,6 @@ do { \ OBD_CONNECT_RMT_CLIENT_FORCE | \ OBD_CONNECT_MDS_CAPA | \ OBD_CONNECT_OSS_CAPA); \ - cfs_spin_lock(&exp->exp_lock); \ - exp->exp_connect_flags = reply->ocd_connect_flags; \ - cfs_spin_unlock(&exp->exp_lock); \ } while (0) int mdt_init_sec_level(struct mdt_thread_info *info) @@ -189,10 +179,6 @@ int mdt_init_sec_level(struct mdt_thread_info *info) reply->ocd_connect_flags &= ~OBD_CONNECT_MDS_CAPA; if (!mdt->mdt_opts.mo_oss_capa) reply->ocd_connect_flags &= ~OBD_CONNECT_OSS_CAPA; - - cfs_spin_lock(&exp->exp_lock); - exp->exp_connect_flags = reply->ocd_connect_flags; - cfs_spin_unlock(&exp->exp_lock); } break; default: @@ -213,10 +199,10 @@ int mdt_init_idmap(struct mdt_thread_info *info) ENTRY; if (exp_connect_rmtclient(exp)) { - cfs_down(&med->med_idmap_sem); + mutex_lock(&med->med_idmap_mutex); if (!med->med_idmap) med->med_idmap = lustre_idmap_init(); - cfs_up(&med->med_idmap_sem); + mutex_unlock(&med->med_idmap_mutex); if (IS_ERR(med->med_idmap)) { long err = PTR_ERR(med->med_idmap); @@ -243,12 +229,12 @@ int mdt_init_idmap(struct mdt_thread_info *info) void mdt_cleanup_idmap(struct mdt_export_data *med) { - cfs_down(&med->med_idmap_sem); + mutex_lock(&med->med_idmap_mutex); if (med->med_idmap != NULL) { lustre_idmap_fini(med->med_idmap); med->med_idmap = NULL; } - cfs_up(&med->med_idmap_sem); + mutex_unlock(&med->med_idmap_mutex); } static inline void mdt_revoke_export_locks(struct obd_export *exp) @@ -403,7 +389,7 @@ int ptlrpc_user_desc_do_idmap(struct ptlrpc_request *req, void mdt_body_reverse_idmap(struct mdt_thread_info *info, struct mdt_body *body) { struct ptlrpc_request *req = mdt_info_req(info); - struct md_ucred *uc = mdt_ucred(info); + struct lu_ucred *uc = mdt_ucred(info); struct mdt_export_data *med = mdt_req2med(req); struct lustre_idmap_table *idmap = med->med_idmap; @@ -441,21 +427,21 @@ void mdt_body_reverse_idmap(struct mdt_thread_info *info, struct mdt_body *body) int mdt_fix_attr_ucred(struct mdt_thread_info *info, __u32 op) { struct ptlrpc_request *req = mdt_info_req(info); - struct md_ucred *uc = mdt_ucred(info); + struct lu_ucred *uc = mdt_ucred_check(info); struct lu_attr *attr = &info->mti_attr.ma_attr; struct mdt_export_data *med = mdt_req2med(req); struct lustre_idmap_table *idmap = med->med_idmap; - if ((uc->mu_valid != UCRED_OLD) && (uc->mu_valid != UCRED_NEW)) - return -EINVAL; + if (uc == NULL) + return -EINVAL; if (op != REINT_SETATTR) { - if ((attr->la_valid & LA_UID) && (attr->la_uid != -1)) - attr->la_uid = uc->mu_fsuid; - /* for S_ISGID, inherit gid from his parent, such work will be - * done in cmm/mdd layer, here set all cases as uc->mu_fsgid. */ - if ((attr->la_valid & LA_GID) && (attr->la_gid != -1)) - attr->la_gid = uc->mu_fsgid; + if ((attr->la_valid & LA_UID) && (attr->la_uid != -1)) + attr->la_uid = uc->uc_fsuid; + /* for S_ISGID, inherit gid from his parent, such work will be + * done in cmm/mdd layer, here set all cases as uc->uc_fsgid. */ + if ((attr->la_valid & LA_GID) && (attr->la_gid != -1)) + attr->la_gid = uc->uc_fsgid; } else if (exp_connect_rmtclient(info->mti_exp)) { /* NB: -1 case will be handled by mdt_fix_attr() later. */ if ((attr->la_valid & LA_UID) && (attr->la_uid != -1)) {