void statfs_unpack(struct kstatfs *sfs, struct obd_statfs *osfs);
/* root squash info */
-struct rw_semaphore;
struct root_squash_info {
uid_t rsi_uid;
gid_t rsi_gid;
struct list_head rsi_nosquash_nids;
- struct rw_semaphore rsi_sem;
+ spinlock_t rsi_lock;
};
int server_name2index(const char *svname, __u32 *idx, const char **endptr);
sbi->ll_squash.rsi_uid = 0;
sbi->ll_squash.rsi_gid = 0;
INIT_LIST_HEAD(&sbi->ll_squash.rsi_nosquash_nids);
- init_rwsem(&sbi->ll_squash.rsi_sem);
+ spin_lock_init(&sbi->ll_squash.rsi_lock);
/* Per-filesystem file heat */
sbi->ll_heat_decay_weight = SBI_DEFAULT_HEAT_DECAY_WEIGHT;
struct lnet_process_id id;
/* Update norootsquash flag */
- down_write(&squash->rsi_sem);
+ spin_lock(&squash->rsi_lock);
if (list_empty(&squash->rsi_nosquash_nids))
sbi->ll_flags &= ~LL_SBI_NOROOTSQUASH;
else {
else
sbi->ll_flags &= ~LL_SBI_NOROOTSQUASH;
}
- up_write(&squash->rsi_sem);
+ spin_unlock(&squash->rsi_lock);
}
/**
struct root_squash_info *squash = &sbi->ll_squash;
int len;
- down_read(&squash->rsi_sem);
+ spin_lock(&squash->rsi_lock);
if (!list_empty(&squash->rsi_nosquash_nids)) {
len = cfs_print_nidlist(m->buf + m->count, m->size - m->count,
&squash->rsi_nosquash_nids);
} else {
seq_puts(m, "NONE\n");
}
- up_read(&squash->rsi_sem);
+ spin_unlock(&squash->rsi_lock);
return 0;
}
m->mdt_squash.rsi_uid = 0;
m->mdt_squash.rsi_gid = 0;
INIT_LIST_HEAD(&m->mdt_squash.rsi_nosquash_nids);
- init_rwsem(&m->mdt_squash.rsi_sem);
+ spin_lock_init(&m->mdt_squash.rsi_lock);
spin_lock_init(&m->mdt_lock);
m->mdt_enable_remote_dir = 1;
m->mdt_enable_striped_dir = 1;
}
}
-static int match_nosquash_list(struct rw_semaphore *sem,
+static int match_nosquash_list(struct spinlock *rsi_lock,
struct list_head *nidlist,
lnet_nid_t peernid)
{
int rc;
ENTRY;
- down_read(sem);
+ spin_lock(rsi_lock);
rc = cfs_match_nid(peernid, nidlist);
- up_read(sem);
+ spin_unlock(rsi_lock);
RETURN(rc);
}
if (!squash->rsi_uid || ucred->uc_fsuid)
RETURN(0);
- if (match_nosquash_list(&squash->rsi_sem,
+ if (match_nosquash_list(&squash->rsi_lock,
&squash->rsi_nosquash_nids,
peernid)) {
CDEBUG(D_OTHER, "%s is in nosquash_nids list\n",
struct root_squash_info *squash = &mdt->mdt_squash;
int len = 0;
- down_read(&squash->rsi_sem);
+ spin_lock(&squash->rsi_lock);
if (!list_empty(&squash->rsi_nosquash_nids)) {
len = cfs_print_nidlist(m->buf + m->count, m->size - m->count,
&squash->rsi_nosquash_nids);
seq_putc(m, '\n');
} else
seq_puts(m, "NONE\n");
- up_read(&squash->rsi_sem);
+ spin_unlock(&squash->rsi_lock);
return 0;
}
if ((len == 4 && strncmp(kernbuf, "NONE", len) == 0) ||
(len == 5 && strncmp(kernbuf, "clear", len) == 0)) {
/* empty string is special case */
- down_write(&squash->rsi_sem);
+ spin_lock(&squash->rsi_lock);
if (!list_empty(&squash->rsi_nosquash_nids))
cfs_free_nidlist(&squash->rsi_nosquash_nids);
- up_write(&squash->rsi_sem);
+ spin_unlock(&squash->rsi_lock);
LCONSOLE_INFO("%s: nosquash_nids is cleared\n", name);
OBD_FREE(kernbuf, count + 1);
RETURN(count);
OBD_FREE(kernbuf, count + 1);
kernbuf = NULL;
- down_write(&squash->rsi_sem);
+ spin_lock(&squash->rsi_lock);
if (!list_empty(&squash->rsi_nosquash_nids))
cfs_free_nidlist(&squash->rsi_nosquash_nids);
list_splice(&tmp, &squash->rsi_nosquash_nids);
- up_write(&squash->rsi_sem);
+ spin_unlock(&squash->rsi_lock);
RETURN(count);