@@ -1689,12 +1689,11 @@ static inline void class_uuid_unparse(class_uuid_t uu, struct obd_uuid *out)
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; /* protects rsi_nosquash_nids */
};
/* linux-module.c */
@@ -131,7 +131,7 @@ static struct ll_sb_info *ll_init_sbi(void)
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);
return sbi;
}
@@ -2578,7 +2578,7 @@ void ll_compute_rootsquash_state(struct ll_sb_info *sbi)
int i;
/* Update norootsquash flag */
- down_write(&squash->rsi_sem);
+ spin_lock(&squash->rsi_lock);
if (list_empty(&squash->rsi_nosquash_nids)) {
spin_lock(&sbi->ll_lock);
sbi->ll_flags &= ~LL_SBI_NOROOTSQUASH;
@@ -2606,7 +2606,7 @@ void ll_compute_rootsquash_state(struct ll_sb_info *sbi)
sbi->ll_flags &= ~LL_SBI_NOROOTSQUASH;
spin_unlock(&sbi->ll_lock);
}
- up_write(&squash->rsi_sem);
+ spin_unlock(&squash->rsi_lock);
}
/**
@@ -1157,7 +1157,7 @@ static int ll_nosquash_nids_seq_show(struct seq_file *m, void *v)
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);
@@ -1166,7 +1166,7 @@ static int ll_nosquash_nids_seq_show(struct seq_file *m, void *v)
} else {
seq_puts(m, "NONE\n");
}
- up_read(&squash->rsi_sem);
+ spin_unlock(&squash->rsi_lock);
return 0;
}
@@ -1747,10 +1747,10 @@ int lprocfs_wr_nosquash_nids(const char __user *buffer, unsigned long count,
if ((len == 4 && !strncmp(kernbuf, "NONE", len)) ||
(len == 5 && !strncmp(kernbuf, "clear", len))) {
/* 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);
kfree(kernbuf);
return count;
@@ -1767,11 +1767,11 @@ int lprocfs_wr_nosquash_nids(const char __user *buffer, unsigned long count,
kfree(kernbuf);
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;