diff options
Diffstat (limited to 'fs')
61 files changed, 474 insertions, 487 deletions
diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c index 9c2bdda5cd9d..0ca9433fa3be 100644 --- a/fs/9p/vfs_dir.c +++ b/fs/9p/vfs_dir.c @@ -107,7 +107,7 @@ static int v9fs_alloc_rdir_buf(struct file *filp, int buflen) err = -ENOMEM; goto exit; } - spin_lock(&filp->f_dentry->d_lock); + seq_spin_lock(&filp->f_dentry->d_lock); if (!fid->rdir) { rdir->buf = (uint8_t *)rdir + sizeof(struct p9_rdir); mutex_init(&rdir->mutex); @@ -115,7 +115,7 @@ static int v9fs_alloc_rdir_buf(struct file *filp, int buflen) fid->rdir = (void *) rdir; rdir = NULL; } - spin_unlock(&filp->f_dentry->d_lock); + seq_spin_unlock(&filp->f_dentry->d_lock); kfree(rdir); } exit: diff --git a/fs/afs/dir.c b/fs/afs/dir.c index 1b0b19550015..84f6bf6d8583 100644 --- a/fs/afs/dir.c +++ b/fs/afs/dir.c @@ -705,9 +705,9 @@ out_skip: /* the dirent, if it exists, now points to a different vnode */ not_found: - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); dentry->d_flags |= DCACHE_NFSFS_RENAMED; - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); out_bad: if (dentry->d_inode) { diff --git a/fs/attr.c b/fs/attr.c index caf2aa521e2b..8d56f3ccd75e 100644 --- a/fs/attr.c +++ b/fs/attr.c @@ -233,7 +233,7 @@ int notify_change(struct dentry * dentry, struct iattr * attr) return error; if (ia_valid & ATTR_SIZE) - down_write(&dentry->d_inode->i_alloc_sem); + anon_down_write(&dentry->d_inode->i_alloc_sem); if (inode->i_op->setattr) error = inode->i_op->setattr(dentry, attr); @@ -241,7 +241,7 @@ int notify_change(struct dentry * dentry, struct iattr * attr) error = simple_setattr(dentry, attr); if (ia_valid & ATTR_SIZE) - up_write(&dentry->d_inode->i_alloc_sem); + anon_up_write(&dentry->d_inode->i_alloc_sem); if (!error) fsnotify_change(dentry, ia_valid); diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h index 756d3286bee5..28df70ea4dee 100644 --- a/fs/autofs4/autofs_i.h +++ b/fs/autofs4/autofs_i.h @@ -34,6 +34,7 @@ #include <linux/sched.h> #include <linux/mount.h> #include <linux/namei.h> +#include <linux/delay.h> #include <asm/current.h> #include <asm/uaccess.h> @@ -207,9 +208,9 @@ static inline void __managed_dentry_set_automount(struct dentry *dentry) static inline void managed_dentry_set_automount(struct dentry *dentry) { - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); __managed_dentry_set_automount(dentry); - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); } static inline void __managed_dentry_clear_automount(struct dentry *dentry) @@ -219,9 +220,9 @@ static inline void __managed_dentry_clear_automount(struct dentry *dentry) static inline void managed_dentry_clear_automount(struct dentry *dentry) { - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); __managed_dentry_clear_automount(dentry); - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); } static inline void __managed_dentry_set_transit(struct dentry *dentry) @@ -231,9 +232,9 @@ static inline void __managed_dentry_set_transit(struct dentry *dentry) static inline void managed_dentry_set_transit(struct dentry *dentry) { - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); __managed_dentry_set_transit(dentry); - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); } static inline void __managed_dentry_clear_transit(struct dentry *dentry) @@ -243,9 +244,9 @@ static inline void __managed_dentry_clear_transit(struct dentry *dentry) static inline void managed_dentry_clear_transit(struct dentry *dentry) { - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); __managed_dentry_clear_transit(dentry); - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); } static inline void __managed_dentry_set_managed(struct dentry *dentry) @@ -255,9 +256,9 @@ static inline void __managed_dentry_set_managed(struct dentry *dentry) static inline void managed_dentry_set_managed(struct dentry *dentry) { - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); __managed_dentry_set_managed(dentry); - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); } static inline void __managed_dentry_clear_managed(struct dentry *dentry) @@ -267,9 +268,9 @@ static inline void __managed_dentry_clear_managed(struct dentry *dentry) static inline void managed_dentry_clear_managed(struct dentry *dentry) { - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); __managed_dentry_clear_managed(dentry); - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); } /* Initializing function */ diff --git a/fs/autofs4/expire.c b/fs/autofs4/expire.c index 450f529a4eae..f4abda3720dd 100644 --- a/fs/autofs4/expire.c +++ b/fs/autofs4/expire.c @@ -99,7 +99,7 @@ static struct dentry *get_next_positive_subdir(struct dentry *prev, spin_lock(&sbi->lookup_lock); if (prev == NULL) { - spin_lock(&root->d_lock); + seq_spin_lock(&root->d_lock); prev = dget_dlock(root); next = prev->d_subdirs.next; p = prev; @@ -107,12 +107,12 @@ static struct dentry *get_next_positive_subdir(struct dentry *prev, } p = prev; - spin_lock(&p->d_lock); + seq_spin_lock(&p->d_lock); again: next = p->d_u.d_child.next; start: if (next == &root->d_subdirs) { - spin_unlock(&p->d_lock); + seq_spin_unlock(&p->d_lock); spin_unlock(&sbi->lookup_lock); dput(prev); return NULL; @@ -120,16 +120,16 @@ start: q = list_entry(next, struct dentry, d_u.d_child); - spin_lock_nested(&q->d_lock, DENTRY_D_LOCK_NESTED); + seq_spin_lock_nested(&q->d_lock, DENTRY_D_LOCK_NESTED); /* Negative dentry - try next */ if (!simple_positive(q)) { - spin_unlock(&p->d_lock); + seq_spin_unlock(&p->d_lock); p = q; goto again; } dget_dlock(q); - spin_unlock(&q->d_lock); - spin_unlock(&p->d_lock); + seq_spin_unlock(&q->d_lock); + seq_spin_unlock(&p->d_lock); spin_unlock(&sbi->lookup_lock); dput(prev); @@ -153,7 +153,7 @@ static struct dentry *get_next_positive_dentry(struct dentry *prev, spin_lock(&sbi->lookup_lock); relock: p = prev; - spin_lock(&p->d_lock); + seq_spin_lock(&p->d_lock); again: next = p->d_subdirs.next; if (next == &p->d_subdirs) { @@ -161,19 +161,19 @@ again: struct dentry *parent; if (p == root) { - spin_unlock(&p->d_lock); + seq_spin_unlock(&p->d_lock); spin_unlock(&sbi->lookup_lock); dput(prev); return NULL; } parent = p->d_parent; - if (!spin_trylock(&parent->d_lock)) { - spin_unlock(&p->d_lock); - cpu_relax(); + if (!seq_spin_trylock(&parent->d_lock)) { + seq_spin_unlock(&p->d_lock); + cpu_chill(); goto relock; } - spin_unlock(&p->d_lock); + seq_spin_unlock(&p->d_lock); next = p->d_u.d_child.next; p = parent; if (next != &parent->d_subdirs) @@ -182,16 +182,16 @@ again: } ret = list_entry(next, struct dentry, d_u.d_child); - spin_lock_nested(&ret->d_lock, DENTRY_D_LOCK_NESTED); + seq_spin_lock_nested(&ret->d_lock, DENTRY_D_LOCK_NESTED); /* Negative dentry - try next */ if (!simple_positive(ret)) { - spin_unlock(&p->d_lock); + seq_spin_unlock(&p->d_lock); p = ret; goto again; } dget_dlock(ret); - spin_unlock(&ret->d_lock); - spin_unlock(&p->d_lock); + seq_spin_unlock(&ret->d_lock); + seq_spin_unlock(&p->d_lock); spin_unlock(&sbi->lookup_lock); dput(prev); @@ -462,11 +462,11 @@ found: init_completion(&ino->expire_complete); spin_unlock(&sbi->fs_lock); spin_lock(&sbi->lookup_lock); - spin_lock(&expired->d_parent->d_lock); - spin_lock_nested(&expired->d_lock, DENTRY_D_LOCK_NESTED); + seq_spin_lock(&expired->d_parent->d_lock); + seq_spin_lock_nested(&expired->d_lock, DENTRY_D_LOCK_NESTED); list_move(&expired->d_parent->d_subdirs, &expired->d_u.d_child); - spin_unlock(&expired->d_lock); - spin_unlock(&expired->d_parent->d_lock); + seq_spin_unlock(&expired->d_lock); + seq_spin_unlock(&expired->d_parent->d_lock); spin_unlock(&sbi->lookup_lock); return expired; } @@ -556,7 +556,7 @@ int autofs4_do_expire_multi(struct super_block *sb, struct vfsmount *mnt, spin_lock(&sbi->fs_lock); ino->flags &= ~AUTOFS_INF_EXPIRING; - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); if (!ret) { if ((IS_ROOT(dentry) || (autofs_type_indirect(sbi->type) && @@ -564,7 +564,7 @@ int autofs4_do_expire_multi(struct super_block *sb, struct vfsmount *mnt, !(dentry->d_flags & DCACHE_NEED_AUTOMOUNT)) __managed_dentry_set_automount(dentry); } - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); complete_all(&ino->expire_complete); spin_unlock(&sbi->fs_lock); dput(dentry); diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c index f55ae23b137e..4a52674164e2 100644 --- a/fs/autofs4/root.c +++ b/fs/autofs4/root.c @@ -124,13 +124,13 @@ static int autofs4_dir_open(struct inode *inode, struct file *file) * it. */ spin_lock(&sbi->lookup_lock); - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); if (!d_mountpoint(dentry) && list_empty(&dentry->d_subdirs)) { - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); spin_unlock(&sbi->lookup_lock); return -ENOENT; } - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); spin_unlock(&sbi->lookup_lock); out: @@ -179,7 +179,7 @@ static struct dentry *autofs4_lookup_active(struct dentry *dentry) ino = list_entry(p, struct autofs_info, active); active = ino->dentry; - spin_lock(&active->d_lock); + seq_spin_lock(&active->d_lock); /* Already gone? */ if (active->d_count == 0) @@ -199,12 +199,12 @@ static struct dentry *autofs4_lookup_active(struct dentry *dentry) if (d_unhashed(active)) { dget_dlock(active); - spin_unlock(&active->d_lock); + seq_spin_unlock(&active->d_lock); spin_unlock(&sbi->lookup_lock); return active; } next: - spin_unlock(&active->d_lock); + seq_spin_unlock(&active->d_lock); } spin_unlock(&sbi->lookup_lock); @@ -231,7 +231,7 @@ static struct dentry *autofs4_lookup_expiring(struct dentry *dentry) ino = list_entry(p, struct autofs_info, expiring); expiring = ino->dentry; - spin_lock(&expiring->d_lock); + seq_spin_lock(&expiring->d_lock); /* Bad luck, we've already been dentry_iput */ if (!expiring->d_inode) @@ -251,12 +251,12 @@ static struct dentry *autofs4_lookup_expiring(struct dentry *dentry) if (d_unhashed(expiring)) { dget_dlock(expiring); - spin_unlock(&expiring->d_lock); + seq_spin_unlock(&expiring->d_lock); spin_unlock(&sbi->lookup_lock); return expiring; } next: - spin_unlock(&expiring->d_lock); + seq_spin_unlock(&expiring->d_lock); } spin_unlock(&sbi->lookup_lock); @@ -382,12 +382,12 @@ static struct vfsmount *autofs4_d_automount(struct path *path) if (have_submounts(dentry)) goto done; } else { - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); if (!list_empty(&dentry->d_subdirs)) { - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); goto done; } - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); } ino->flags |= AUTOFS_INF_PENDING; spin_unlock(&sbi->fs_lock); @@ -410,12 +410,12 @@ done: * an actual mount so ->d_automount() won't be called during * the follow. */ - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); if ((!d_mountpoint(dentry) && !list_empty(&dentry->d_subdirs)) || (dentry->d_inode && S_ISLNK(dentry->d_inode->i_mode))) __managed_dentry_clear_automount(dentry); - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); } spin_unlock(&sbi->fs_lock); @@ -597,9 +597,9 @@ static int autofs4_dir_unlink(struct inode *dir, struct dentry *dentry) spin_lock(&sbi->lookup_lock); __autofs4_add_expiring(dentry); - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); __d_drop(dentry); - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); spin_unlock(&sbi->lookup_lock); return 0; @@ -670,15 +670,15 @@ static int autofs4_dir_rmdir(struct inode *dir, struct dentry *dentry) return -EACCES; spin_lock(&sbi->lookup_lock); - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); if (!list_empty(&dentry->d_subdirs)) { - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); spin_unlock(&sbi->lookup_lock); return -ENOTEMPTY; } __autofs4_add_expiring(dentry); __d_drop(dentry); - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); spin_unlock(&sbi->lookup_lock); if (sbi->version < 5) diff --git a/fs/btrfs/export.c b/fs/btrfs/export.c index 1b8dc33778f9..c473324bc01f 100644 --- a/fs/btrfs/export.c +++ b/fs/btrfs/export.c @@ -40,14 +40,14 @@ static int btrfs_encode_fh(struct dentry *dentry, u32 *fh, int *max_len, struct inode *parent; u64 parent_root_id; - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); parent = dentry->d_parent->d_inode; fid->parent_objectid = BTRFS_I(parent)->location.objectid; fid->parent_gen = parent->i_generation; parent_root_id = BTRFS_I(parent)->root->objectid; - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); if (parent_root_id != fid->root_objectid) { fid->parent_root_objectid = parent_root_id; diff --git a/fs/btrfs/locking.c b/fs/btrfs/locking.c index 66fa43dc3f0f..3b02fb1729d2 100644 --- a/fs/btrfs/locking.c +++ b/fs/btrfs/locking.c @@ -93,6 +93,7 @@ static int btrfs_spin_on_block(struct extent_buffer *eb) */ int btrfs_try_spin_lock(struct extent_buffer *eb) { +#ifndef CONFIG_PREEMPT_RT_FULL int i; if (btrfs_spin_on_block(eb)) { @@ -112,6 +113,7 @@ int btrfs_try_spin_lock(struct extent_buffer *eb) return 1; spin_unlock(&eb->lock); } +#endif return 0; } diff --git a/fs/buffer.c b/fs/buffer.c index 330cbce11413..45f85891b88e 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -328,8 +328,7 @@ static void end_buffer_async_read(struct buffer_head *bh, int uptodate) * decide that the page is now completely done. */ first = page_buffers(page); - local_irq_save(flags); - bit_spin_lock(BH_Uptodate_Lock, &first->b_state); + flags = bh_uptodate_lock_irqsave(first); clear_buffer_async_read(bh); unlock_buffer(bh); tmp = bh; @@ -342,8 +341,7 @@ static void end_buffer_async_read(struct buffer_head *bh, int uptodate) } tmp = tmp->b_this_page; } while (tmp != bh); - bit_spin_unlock(BH_Uptodate_Lock, &first->b_state); - local_irq_restore(flags); + bh_uptodate_unlock_irqrestore(first, flags); /* * If none of the buffers had errors and they are all @@ -355,9 +353,7 @@ static void end_buffer_async_read(struct buffer_head *bh, int uptodate) return; still_busy: - bit_spin_unlock(BH_Uptodate_Lock, &first->b_state); - local_irq_restore(flags); - return; + bh_uptodate_unlock_irqrestore(first, flags); } /* @@ -391,8 +387,7 @@ void end_buffer_async_write(struct buffer_head *bh, int uptodate) } first = page_buffers(page); - local_irq_save(flags); - bit_spin_lock(BH_Uptodate_Lock, &first->b_state); + flags = bh_uptodate_lock_irqsave(first); clear_buffer_async_write(bh); unlock_buffer(bh); @@ -404,15 +399,12 @@ void end_buffer_async_write(struct buffer_head *bh, int uptodate) } tmp = tmp->b_this_page; } - bit_spin_unlock(BH_Uptodate_Lock, &first->b_state); - local_irq_restore(flags); + bh_uptodate_unlock_irqrestore(first, flags); end_page_writeback(page); return; still_busy: - bit_spin_unlock(BH_Uptodate_Lock, &first->b_state); - local_irq_restore(flags); - return; + bh_uptodate_unlock_irqrestore(first, flags); } EXPORT_SYMBOL(end_buffer_async_write); @@ -3222,6 +3214,7 @@ struct buffer_head *alloc_buffer_head(gfp_t gfp_flags) struct buffer_head *ret = kmem_cache_zalloc(bh_cachep, gfp_flags); if (ret) { INIT_LIST_HEAD(&ret->b_assoc_buffers); + buffer_head_init_locks(ret); preempt_disable(); __this_cpu_inc(bh_accounting.nr); recalc_bh_state(); diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index f605753c8fe9..2c2ac3ad4812 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c @@ -3065,14 +3065,14 @@ int ceph_encode_dentry_release(void **p, struct dentry *dentry, * doesn't have to be perfect; the mds will revoke anything we don't * release. */ - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); if (di->lease_session && di->lease_session->s_mds == mds) force = 1; - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); ret = ceph_encode_inode_release(p, dir, mds, drop, unless, force); - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); if (ret && di->lease_session && di->lease_session->s_mds == mds) { dout("encode_dentry_release %p mds%d seq %d\n", dentry, mds, (int)di->lease_seq); @@ -3082,6 +3082,6 @@ int ceph_encode_dentry_release(void **p, struct dentry *dentry, rel->dname_seq = cpu_to_le32(di->lease_seq); __ceph_mdsc_drop_dentry_lease(dentry); } - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); return ret; } diff --git a/fs/ceph/debugfs.c b/fs/ceph/debugfs.c index 0dba6915712b..0ecffe20ca55 100644 --- a/fs/ceph/debugfs.c +++ b/fs/ceph/debugfs.c @@ -82,13 +82,13 @@ static int mdsc_show(struct seq_file *s, void *p) &pathbase, 0); if (IS_ERR(path)) path = NULL; - spin_lock(&req->r_dentry->d_lock); + seq_spin_lock(&req->r_dentry->d_lock); seq_printf(s, " #%llx/%.*s (%s)", ceph_ino(req->r_dentry->d_parent->d_inode), req->r_dentry->d_name.len, req->r_dentry->d_name.name, path ? path : ""); - spin_unlock(&req->r_dentry->d_lock); + seq_spin_unlock(&req->r_dentry->d_lock); kfree(path); } else if (req->r_path1) { seq_printf(s, " #%llx/%s", req->r_ino1.ino, @@ -100,13 +100,13 @@ static int mdsc_show(struct seq_file *s, void *p) &pathbase, 0); if (IS_ERR(path)) path = NULL; - spin_lock(&req->r_old_dentry->d_lock); + seq_spin_lock(&req->r_old_dentry->d_lock); seq_printf(s, " #%llx/%.*s (%s)", ceph_ino(req->r_old_dentry->d_parent->d_inode), req->r_old_dentry->d_name.len, req->r_old_dentry->d_name.name, path ? path : ""); - spin_unlock(&req->r_old_dentry->d_lock); + seq_spin_unlock(&req->r_old_dentry->d_lock); kfree(path); } else if (req->r_path2) { if (req->r_ino2.ino) diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index ef8f08c343e8..f0f6efdebead 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c @@ -52,7 +52,7 @@ int ceph_init_dentry(struct dentry *dentry) if (!di) return -ENOMEM; /* oh well */ - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); if (dentry->d_fsdata) { /* lost a race */ kmem_cache_free(ceph_dentry_cachep, di); @@ -64,7 +64,7 @@ int ceph_init_dentry(struct dentry *dentry) dentry->d_time = jiffies; ceph_dentry_lru_add(dentry); out_unlock: - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); return 0; } @@ -112,7 +112,7 @@ static int __dcache_readdir(struct file *filp, dout("__dcache_readdir %p at %llu (last %p)\n", dir, filp->f_pos, last); - spin_lock(&parent->d_lock); + seq_spin_lock(&parent->d_lock); /* start at beginning? */ if (filp->f_pos == 2 || last == NULL || @@ -136,7 +136,7 @@ more: fi->at_end = 1; goto out_unlock; } - spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); + seq_spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); if (!d_unhashed(dentry) && dentry->d_inode && ceph_snap(dentry->d_inode) != CEPH_SNAPDIR && ceph_ino(dentry->d_inode) != CEPH_INO_CEPH && @@ -146,15 +146,15 @@ more: dentry->d_name.len, dentry->d_name.name, di->offset, filp->f_pos, d_unhashed(dentry) ? " unhashed" : "", !dentry->d_inode ? " null" : ""); - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); p = p->prev; dentry = list_entry(p, struct dentry, d_u.d_child); di = ceph_dentry(dentry); } dget_dlock(dentry); - spin_unlock(&dentry->d_lock); - spin_unlock(&parent->d_lock); + seq_spin_unlock(&dentry->d_lock); + seq_spin_unlock(&parent->d_lock); dout(" %llu (%llu) dentry %p %.*s %p\n", di->offset, filp->f_pos, dentry, dentry->d_name.len, dentry->d_name.name, dentry->d_inode); @@ -187,12 +187,12 @@ more: goto out; } - spin_lock(&parent->d_lock); + seq_spin_lock(&parent->d_lock); p = p->prev; /* advance to next dentry */ goto more; out_unlock: - spin_unlock(&parent->d_lock); + seq_spin_unlock(&parent->d_lock); out: if (last) dput(last); @@ -917,10 +917,10 @@ static int ceph_rename(struct inode *old_dir, struct dentry *old_dentry, */ void ceph_invalidate_dentry_lease(struct dentry *dentry) { - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); dentry->d_time = jiffies; ceph_dentry(dentry)->lease_shared_gen = 0; - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); } /* @@ -938,7 +938,7 @@ static int dentry_lease_is_valid(struct dentry *dentry) struct inode *dir = NULL; u32 seq = 0; - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); di = ceph_dentry(dentry); if (di && di->lease_session) { s = di->lease_session; @@ -962,7 +962,7 @@ static int dentry_lease_is_valid(struct dentry *dentry) } } } - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); if (session) { ceph_mdsc_lease_send_msg(session, dir, dentry, diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index d8858e96ab18..11f11ed39466 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -804,7 +804,7 @@ static void update_dentry_lease(struct dentry *dentry, if (dentry->d_op != &ceph_dentry_ops) return; - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); dout("update_dentry_lease %p mask %d duration %lu ms ttl %lu\n", dentry, le16_to_cpu(lease->mask), duration, ttl); @@ -832,7 +832,7 @@ static void update_dentry_lease(struct dentry *dentry, di->lease_renew_from = 0; dentry->d_time = ttl; out_unlock: - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); return; } @@ -858,13 +858,13 @@ static void ceph_set_dentry_offset(struct dentry *dn) di->offset = ceph_inode(inode)->i_max_offset++; spin_unlock(&inode->i_lock); - spin_lock(&dir->d_lock); - spin_lock_nested(&dn->d_lock, DENTRY_D_LOCK_NESTED); + seq_spin_lock(&dir->d_lock); + seq_spin_lock_nested(&dn->d_lock, DENTRY_D_LOCK_NESTED); list_move(&dn->d_u.d_child, &dir->d_subdirs); dout("set_dentry_offset %p %lld (%p %p)\n", dn, di->offset, dn->d_u.d_child.prev, dn->d_u.d_child.next); - spin_unlock(&dn->d_lock); - spin_unlock(&dir->d_lock); + seq_spin_unlock(&dn->d_lock); + seq_spin_unlock(&dir->d_lock); } /* @@ -1248,11 +1248,11 @@ retry_lookup: goto retry_lookup; } else { /* reorder parent's d_subdirs */ - spin_lock(&parent->d_lock); - spin_lock_nested(&dn->d_lock, DENTRY_D_LOCK_NESTED); + seq_spin_lock(&parent->d_lock); + seq_spin_lock_nested(&dn->d_lock, DENTRY_D_LOCK_NESTED); list_move(&dn->d_u.d_child, &parent->d_subdirs); - spin_unlock(&dn->d_lock); - spin_unlock(&parent->d_lock); + seq_spin_unlock(&dn->d_lock); + seq_spin_unlock(&parent->d_lock); } di = dn->d_fsdata; diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 0c1d91756528..da647098a89c 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -1476,7 +1476,7 @@ retry: for (temp = dentry; !IS_ROOT(temp) && pos != 0; ) { struct inode *inode; - spin_lock(&temp->d_lock); + seq_spin_lock(&temp->d_lock); inode = temp->d_inode; if (inode && ceph_snap(inode) == CEPH_SNAPDIR) { dout("build_path path+%d: %p SNAPDIR\n", @@ -1487,13 +1487,13 @@ retry: } else { pos -= temp->d_name.len; if (pos < 0) { - spin_unlock(&temp->d_lock); + seq_spin_unlock(&temp->d_lock); break; } strncpy(path + pos, temp->d_name.name, temp->d_name.len); } - spin_unlock(&temp->d_lock); + seq_spin_unlock(&temp->d_lock); if (pos) path[--pos] = '/'; temp = temp->d_parent; @@ -2758,7 +2758,7 @@ static void handle_lease(struct ceph_mds_client *mdsc, if (!dentry) goto release; - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); di = ceph_dentry(dentry); switch (h->action) { case CEPH_MDS_LEASE_REVOKE: @@ -2786,7 +2786,7 @@ static void handle_lease(struct ceph_mds_client *mdsc, } break; } - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); dput(dentry); if (!release) @@ -2861,7 +2861,7 @@ void ceph_mdsc_lease_release(struct ceph_mds_client *mdsc, struct inode *inode, BUG_ON(mask == 0); /* is dentry lease valid? */ - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); di = ceph_dentry(dentry); if (!di || !di->lease_session || di->lease_session->s_mds < 0 || @@ -2870,7 +2870,7 @@ void ceph_mdsc_lease_release(struct ceph_mds_client *mdsc, struct inode *inode, dout("lease_release inode %p dentry %p -- " "no lease on %d\n", inode, dentry, mask); - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); return; } @@ -2878,7 +2878,7 @@ void ceph_mdsc_lease_release(struct ceph_mds_client *mdsc, struct inode *inode, session = ceph_get_mds_session(di->lease_session); seq = di->lease_seq; __ceph_mdsc_drop_dentry_lease(dentry); - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); dout("lease_release inode %p dentry %p mask %d to mds%d\n", inode, dentry, mask, session->s_mds); diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index ed5c07b0cdb1..ad8b9331d49f 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c @@ -88,10 +88,10 @@ cifs_bp_rename_retry: full_path[namelen] = 0; /* trailing null */ rcu_read_lock(); for (temp = direntry; !IS_ROOT(temp);) { - spin_lock(&temp->d_lock); + seq_spin_lock(&temp->d_lock); namelen -= 1 + temp->d_name.len; if (namelen < 0) { - spin_unlock(&temp->d_lock); + seq_spin_unlock(&temp->d_lock); break; } else { full_path[namelen] = dirsep; @@ -99,7 +99,7 @@ cifs_bp_rename_retry: temp->d_name.len); cFYI(0, "name: %s", full_path + namelen); } - spin_unlock(&temp->d_lock); + seq_spin_unlock(&temp->d_lock); temp = temp->d_parent; if (temp == NULL) { cERROR(1, "corrupt dentry"); diff --git a/fs/coda/cache.c b/fs/coda/cache.c index 690157876184..93b5810ef198 100644 --- a/fs/coda/cache.c +++ b/fs/coda/cache.c @@ -92,7 +92,7 @@ static void coda_flag_children(struct dentry *parent, int flag) struct list_head *child; struct dentry *de; - spin_lock(&parent->d_lock); + seq_spin_lock(&parent->d_lock); list_for_each(child, &parent->d_subdirs) { de = list_entry(child, struct dentry, d_u.d_child); @@ -101,7 +101,7 @@ static void coda_flag_children(struct dentry *parent, int flag) continue; coda_flag_inode(de->d_inode, flag); } - spin_unlock(&parent->d_lock); + seq_spin_unlock(&parent->d_lock); return; } diff --git a/fs/configfs/configfs_internal.h b/fs/configfs/configfs_internal.h index 82bda8fdfc1c..2ebef5e82c5d 100644 --- a/fs/configfs/configfs_internal.h +++ b/fs/configfs/configfs_internal.h @@ -121,7 +121,7 @@ static inline struct config_item *configfs_get_config_item(struct dentry *dentry { struct config_item * item = NULL; - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); if (!d_unhashed(dentry)) { struct configfs_dirent * sd = dentry->d_fsdata; if (sd->s_type & CONFIGFS_ITEM_LINK) { @@ -130,7 +130,7 @@ static inline struct config_item *configfs_get_config_item(struct dentry *dentry } else item = config_item_get(sd->s_element); } - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); return item; } diff --git a/fs/configfs/inode.c b/fs/configfs/inode.c index c83f4768eeaa..84d7e959fc2a 100644 --- a/fs/configfs/inode.c +++ b/fs/configfs/inode.c @@ -250,14 +250,14 @@ void configfs_drop_dentry(struct configfs_dirent * sd, struct dentry * parent) struct dentry * dentry = sd->s_dentry; if (dentry) { - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); if (!(d_unhashed(dentry) && dentry->d_inode)) { dget_dlock(dentry); __d_drop(dentry); - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); simple_unlink(parent->d_inode, dentry); } else - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); } } diff --git a/fs/dcache.c b/fs/dcache.c index 0b51cfc9291a..3722ba3e1c56 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -36,6 +36,7 @@ #include <linux/bit_spinlock.h> #include <linux/rculist_bl.h> #include <linux/prefetch.h> +#include <linux/delay.h> #include "internal.h" /* @@ -171,9 +172,9 @@ static void d_free(struct dentry *dentry) */ static inline void dentry_rcuwalk_barrier(struct dentry *dentry) { - assert_spin_locked(&dentry->d_lock); + assert_seq_spin_locked(&dentry->d_lock); /* Go through a barrier */ - write_seqcount_barrier(&dentry->d_seq); + write_seqlock_barrier(&dentry->d_lock); } /* @@ -189,7 +190,7 @@ static void dentry_iput(struct dentry * dentry) if (inode) { dentry->d_inode = NULL; list_del_init(&dentry->d_alias); - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); spin_unlock(&inode->i_lock); if (!inode->i_nlink) fsnotify_inoderemove(inode); @@ -198,7 +199,7 @@ static void dentry_iput(struct dentry * dentry) else iput(inode); } else { - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); } } @@ -214,7 +215,7 @@ static void dentry_unlink_inode(struct dentry * dentry) dentry->d_inode = NULL; list_del_init(&dentry->d_alias); dentry_rcuwalk_barrier(dentry); - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); spin_unlock(&inode->i_lock); if (!inode->i_nlink) fsnotify_inoderemove(inode); @@ -292,7 +293,7 @@ static struct dentry *d_kill(struct dentry *dentry, struct dentry *parent) */ dentry->d_flags |= DCACHE_DISCONNECTED; if (parent) - spin_unlock(&parent->d_lock); + seq_spin_unlock(&parent->d_lock); dentry_iput(dentry); /* * dentry_iput drops the locks, at which point nobody (except @@ -338,9 +339,9 @@ EXPORT_SYMBOL(__d_drop); void d_drop(struct dentry *dentry) { - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); __d_drop(dentry); - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); } EXPORT_SYMBOL(d_drop); @@ -359,15 +360,15 @@ static inline struct dentry *dentry_kill(struct dentry *dentry, int ref) inode = dentry->d_inode; if (inode && !spin_trylock(&inode->i_lock)) { relock: - spin_unlock(&dentry->d_lock); - cpu_relax(); + seq_spin_unlock(&dentry->d_lock); + cpu_chill(); return dentry; /* try again with same dentry */ } if (IS_ROOT(dentry)) parent = NULL; else parent = dentry->d_parent; - if (parent && !spin_trylock(&parent->d_lock)) { + if (parent && !seq_spin_trylock(&parent->d_lock)) { if (inode) spin_unlock(&inode->i_lock); goto relock; @@ -416,11 +417,11 @@ void dput(struct dentry *dentry) repeat: if (dentry->d_count == 1) might_sleep(); - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); BUG_ON(!dentry->d_count); if (dentry->d_count > 1) { dentry->d_count--; - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); return; } @@ -438,7 +439,7 @@ repeat: dentry_lru_add(dentry); dentry->d_count--; - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); return; kill_it: @@ -465,9 +466,9 @@ int d_invalidate(struct dentry * dentry) /* * If it's already been dropped, return OK. */ - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); if (d_unhashed(dentry)) { - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); return 0; } /* @@ -475,9 +476,9 @@ int d_invalidate(struct dentry * dentry) * to get rid of unused child entries. */ if (!list_empty(&dentry->d_subdirs)) { - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); shrink_dcache_parent(dentry); - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); } /* @@ -492,13 +493,13 @@ int d_invalidate(struct dentry * dentry) */ if (dentry->d_count > 1) { if (dentry->d_inode && S_ISDIR(dentry->d_inode->i_mode)) { - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); return -EBUSY; } } __d_drop(dentry); - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); return 0; } EXPORT_SYMBOL(d_invalidate); @@ -511,9 +512,9 @@ static inline void __dget_dlock(struct dentry *dentry) static inline void __dget(struct dentry *dentry) { - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); __dget_dlock(dentry); - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); } struct dentry *dget_parent(struct dentry *dentry) @@ -531,16 +532,16 @@ repeat: rcu_read_unlock(); goto out; } - spin_lock(&ret->d_lock); + seq_spin_lock(&ret->d_lock); if (unlikely(ret != dentry->d_parent)) { - spin_unlock(&ret->d_lock); + seq_spin_unlock(&ret->d_lock); rcu_read_unlock(); goto repeat; } rcu_read_unlock(); BUG_ON(!ret->d_count); ret->d_count++; - spin_unlock(&ret->d_lock); + seq_spin_unlock(&ret->d_lock); out: return ret; } @@ -569,31 +570,31 @@ static struct dentry *__d_find_alias(struct inode *inode, int want_discon) again: discon_alias = NULL; list_for_each_entry(alias, &inode->i_dentry, d_alias) { - spin_lock(&alias->d_lock); + seq_spin_lock(&alias->d_lock); if (S_ISDIR(inode->i_mode) || !d_unhashed(alias)) { if (IS_ROOT(alias) && (alias->d_flags & DCACHE_DISCONNECTED)) { discon_alias = alias; } else if (!want_discon) { __dget_dlock(alias); - spin_unlock(&alias->d_lock); + seq_spin_unlock(&alias->d_lock); return alias; } } - spin_unlock(&alias->d_lock); + seq_spin_unlock(&alias->d_lock); } if (discon_alias) { alias = discon_alias; - spin_lock(&alias->d_lock); + seq_spin_lock(&alias->d_lock); if (S_ISDIR(inode->i_mode) || !d_unhashed(alias)) { if (IS_ROOT(alias) && (alias->d_flags & DCACHE_DISCONNECTED)) { __dget_dlock(alias); - spin_unlock(&alias->d_lock); + seq_spin_unlock(&alias->d_lock); return alias; } } - spin_unlock(&alias->d_lock); + seq_spin_unlock(&alias->d_lock); goto again; } return NULL; @@ -622,16 +623,16 @@ void d_prune_aliases(struct inode *inode) restart: spin_lock(&inode->i_lock); list_for_each_entry(dentry, &inode->i_dentry, d_alias) { - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); if (!dentry->d_count) { __dget_dlock(dentry); __d_drop(dentry); - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); spin_unlock(&inode->i_lock); dput(dentry); goto restart; } - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); } spin_unlock(&inode->i_lock); } @@ -668,10 +669,10 @@ static void try_prune_one_dentry(struct dentry *dentry) /* Prune ancestors. */ dentry = parent; while (dentry) { - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); if (dentry->d_count > 1) { dentry->d_count--; - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); return; } dentry = dentry_kill(dentry, 1); @@ -687,9 +688,9 @@ static void shrink_dentry_list(struct list_head *list) dentry = list_entry_rcu(list->prev, struct dentry, d_lru); if (&dentry->d_lru == list) break; /* empty */ - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); if (dentry != list_entry(list->prev, struct dentry, d_lru)) { - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); continue; } @@ -700,7 +701,7 @@ static void shrink_dentry_list(struct list_head *list) */ if (dentry->d_count) { dentry_lru_del(dentry); - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); continue; } @@ -736,9 +737,9 @@ relock: struct dentry, d_lru); BUG_ON(dentry->d_sb != sb); - if (!spin_trylock(&dentry->d_lock)) { + if (!seq_spin_trylock(&dentry->d_lock)) { spin_unlock(&dcache_lru_lock); - cpu_relax(); + cpu_chill(); goto relock; } @@ -751,11 +752,11 @@ relock: dentry->d_flags & DCACHE_REFERENCED) { dentry->d_flags &= ~DCACHE_REFERENCED; list_move(&dentry->d_lru, &referenced); - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); } else { list_move_tail(&dentry->d_lru, &tmp); dentry->d_flags |= DCACHE_SHRINK_LIST; - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); if (!--cnt) break; } @@ -880,10 +881,10 @@ static void shrink_dcache_for_umount_subtree(struct dentry *dentry) BUG_ON(!IS_ROOT(dentry)); /* detach this root from the system */ - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); dentry_lru_del(dentry); __d_drop(dentry); - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); for (;;) { /* descend to the first leaf in the current subtree */ @@ -892,16 +893,16 @@ static void shrink_dcache_for_umount_subtree(struct dentry *dentry) /* this is a branch with children - detach all of them * from the system in one go */ - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); list_for_each_entry(loop, &dentry->d_subdirs, d_u.d_child) { - spin_lock_nested(&loop->d_lock, + seq_spin_lock_nested(&loop->d_lock, DENTRY_D_LOCK_NESTED); dentry_lru_del(loop); __d_drop(loop); - spin_unlock(&loop->d_lock); + seq_spin_unlock(&loop->d_lock); } - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); /* move to the first child */ dentry = list_entry(dentry->d_subdirs.next, @@ -933,10 +934,10 @@ static void shrink_dcache_for_umount_subtree(struct dentry *dentry) list_del(&dentry->d_u.d_child); } else { parent = dentry->d_parent; - spin_lock(&parent->d_lock); + seq_spin_lock(&parent->d_lock); parent->d_count--; list_del(&dentry->d_u.d_child); - spin_unlock(&parent->d_lock); + seq_spin_unlock(&parent->d_lock); } detached++; @@ -985,9 +986,9 @@ void shrink_dcache_for_umount(struct super_block *sb) dentry = sb->s_root; sb->s_root = NULL; - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); dentry->d_count--; - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); shrink_dcache_for_umount_subtree(dentry); while (!hlist_bl_empty(&sb->s_anon)) { @@ -1007,8 +1008,8 @@ static struct dentry *try_to_ascend(struct dentry *old, int locked, unsigned seq struct dentry *new = old->d_parent; rcu_read_lock(); - spin_unlock(&old->d_lock); - spin_lock(&new->d_lock); + seq_spin_unlock(&old->d_lock); + seq_spin_lock(&new->d_lock); /* * might go back up the wrong parent if we have had a rename @@ -1017,7 +1018,7 @@ static struct dentry *try_to_ascend(struct dentry *old, int locked, unsigned seq if (new != old->d_parent || (old->d_flags & DCACHE_DISCONNECTED) || (!locked && read_seqretry(&rename_lock, seq))) { - spin_unlock(&new->d_lock); + seq_spin_unlock(&new->d_lock); new = NULL; } rcu_read_unlock(); @@ -1051,7 +1052,7 @@ again: if (d_mountpoint(parent)) goto positive; - spin_lock(&this_parent->d_lock); + seq_spin_lock(&this_parent->d_lock); repeat: next = this_parent->d_subdirs.next; resume: @@ -1060,21 +1061,21 @@ resume: struct dentry *dentry = list_entry(tmp, struct dentry, d_u.d_child); next = tmp->next; - spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); + seq_spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); /* Have we found a mount point ? */ if (d_mountpoint(dentry)) { - spin_unlock(&dentry->d_lock); - spin_unlock(&this_parent->d_lock); + seq_spin_unlock(&dentry->d_lock); + seq_spin_unlock(&this_parent->d_lock); goto positive; } if (!list_empty(&dentry->d_subdirs)) { - spin_unlock(&this_parent->d_lock); - spin_release(&dentry->d_lock.dep_map, 1, _RET_IP_); + seq_spin_unlock(&this_parent->d_lock); + spin_release(&dentry->d_lock.lock.dep_map, 1, _RET_IP_); this_parent = dentry; - spin_acquire(&this_parent->d_lock.dep_map, 0, 1, _RET_IP_); + spin_acquire(&this_parent->d_lock.lock.dep_map, 0, 1, _RET_IP_); goto repeat; } - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); } /* * All done at this level ... ascend and resume the search. @@ -1087,7 +1088,7 @@ resume: next = child->d_u.d_child.next; goto resume; } - spin_unlock(&this_parent->d_lock); + seq_spin_unlock(&this_parent->d_lock); if (!locked && read_seqretry(&rename_lock, seq)) goto rename_retry; if (locked) @@ -1132,7 +1133,7 @@ static int select_parent(struct dentry * parent) seq = read_seqbegin(&rename_lock); again: this_parent = parent; - spin_lock(&this_parent->d_lock); + seq_spin_lock(&this_parent->d_lock); repeat: next = this_parent->d_subdirs.next; resume: @@ -1141,7 +1142,7 @@ resume: struct dentry *dentry = list_entry(tmp, struct dentry, d_u.d_child); next = tmp->next; - spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); + seq_spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); /* * move only zero ref count dentries to the end @@ -1164,7 +1165,7 @@ resume: * the rest. */ if (found && need_resched()) { - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); goto out; } @@ -1172,14 +1173,14 @@ resume: * Descend a level if the d_subdirs list is non-empty. */ if (!list_empty(&dentry->d_subdirs)) { - spin_unlock(&this_parent->d_lock); - spin_release(&dentry->d_lock.dep_map, 1, _RET_IP_); + seq_spin_unlock(&this_parent->d_lock); + spin_release(&dentry->d_lock.lock.dep_map, 1, _RET_IP_); this_parent = dentry; - spin_acquire(&this_parent->d_lock.dep_map, 0, 1, _RET_IP_); + spin_acquire(&this_parent->d_lock.lock.dep_map, 0, 1, _RET_IP_); goto repeat; } - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); } /* * All done at this level ... ascend and resume the search. @@ -1193,7 +1194,7 @@ resume: goto resume; } out: - spin_unlock(&this_parent->d_lock); + seq_spin_unlock(&this_parent->d_lock); if (!locked && read_seqretry(&rename_lock, seq)) goto rename_retry; if (locked) @@ -1294,8 +1295,7 @@ struct dentry *d_alloc(struct dentry * parent, const struct qstr *name) dentry->d_count = 1; dentry->d_flags = 0; - spin_lock_init(&dentry->d_lock); - seqcount_init(&dentry->d_seq); + seqlock_init(&dentry->d_lock); dentry->d_inode = NULL; dentry->d_parent = NULL; dentry->d_sb = NULL; @@ -1308,7 +1308,7 @@ struct dentry *d_alloc(struct dentry * parent, const struct qstr *name) INIT_LIST_HEAD(&dentry->d_u.d_child); if (parent) { - spin_lock(&parent->d_lock); + seq_spin_lock(&parent->d_lock); /* * don't need child lock because it is not subject * to concurrency here @@ -1318,7 +1318,7 @@ struct dentry *d_alloc(struct dentry * parent, const struct qstr *name) dentry->d_sb = parent->d_sb; d_set_d_op(dentry, dentry->d_sb->s_d_op); list_add(&dentry->d_u.d_child, &parent->d_subdirs); - spin_unlock(&parent->d_lock); + seq_spin_unlock(&parent->d_lock); } this_cpu_inc(nr_dentry); @@ -1375,7 +1375,7 @@ EXPORT_SYMBOL(d_set_d_op); static void __d_instantiate(struct dentry *dentry, struct inode *inode) { - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); if (inode) { if (unlikely(IS_AUTOMOUNT(inode))) dentry->d_flags |= DCACHE_NEED_AUTOMOUNT; @@ -1383,7 +1383,7 @@ static void __d_instantiate(struct dentry *dentry, struct inode *inode) } dentry->d_inode = inode; dentry_rcuwalk_barrier(dentry); - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); fsnotify_d_instantiate(dentry, inode); } @@ -1589,7 +1589,7 @@ struct dentry *d_obtain_alias(struct inode *inode) } /* attach a disconnected dentry */ - spin_lock(&tmp->d_lock); + seq_spin_lock(&tmp->d_lock); tmp->d_sb = inode->i_sb; d_set_d_op(tmp, tmp->d_sb->s_d_op); tmp->d_inode = inode; @@ -1598,7 +1598,7 @@ struct dentry *d_obtain_alias(struct inode *inode) hlist_bl_lock(&tmp->d_sb->s_anon); hlist_bl_add_head(&tmp->d_hash, &tmp->d_sb->s_anon); hlist_bl_unlock(&tmp->d_sb->s_anon); - spin_unlock(&tmp->d_lock); + seq_spin_unlock(&tmp->d_lock); spin_unlock(&inode->i_lock); security_d_instantiate(tmp, inode); @@ -1810,7 +1810,7 @@ struct dentry *__d_lookup_rcu(struct dentry *parent, struct qstr *name, continue; seqretry: - *seq = read_seqcount_begin(&dentry->d_seq); + *seq = read_seqbegin(&dentry->d_lock); if (dentry->d_parent != parent) continue; if (d_unhashed(dentry)) @@ -1825,7 +1825,7 @@ seqretry: * edge of memory when walking. If we could load this * atomically some other way, we could drop this check. */ - if (read_seqcount_retry(&dentry->d_seq, *seq)) + if (read_seqretry(&dentry->d_lock, *seq)) goto seqretry; if (parent->d_flags & DCACHE_OP_COMPARE) { if (parent->d_op->d_compare(parent, *inode, @@ -1928,7 +1928,7 @@ struct dentry *__d_lookup(struct dentry *parent, struct qstr *name) if (dentry->d_name.hash != hash) continue; - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); if (dentry->d_parent != parent) goto next; if (d_unhashed(dentry)) @@ -1952,10 +1952,10 @@ struct dentry *__d_lookup(struct dentry *parent, struct qstr *name) dentry->d_count++; found = dentry; - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); break; next: - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); } rcu_read_unlock(); @@ -2003,17 +2003,17 @@ int d_validate(struct dentry *dentry, struct dentry *dparent) { struct dentry *child; - spin_lock(&dparent->d_lock); + seq_spin_lock(&dparent->d_lock); list_for_each_entry(child, &dparent->d_subdirs, d_u.d_child) { if (dentry == child) { - spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); + seq_spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); __dget_dlock(dentry); - spin_unlock(&dentry->d_lock); - spin_unlock(&dparent->d_lock); + seq_spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dparent->d_lock); return 1; } } - spin_unlock(&dparent->d_lock); + seq_spin_unlock(&dparent->d_lock); return 0; } @@ -2048,13 +2048,13 @@ void d_delete(struct dentry * dentry) * Are we the only user? */ again: - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); inode = dentry->d_inode; isdir = S_ISDIR(inode->i_mode); if (dentry->d_count == 1) { if (inode && !spin_trylock(&inode->i_lock)) { - spin_unlock(&dentry->d_lock); - cpu_relax(); + seq_spin_unlock(&dentry->d_lock); + cpu_chill(); goto again; } dentry->d_flags &= ~DCACHE_CANT_MOUNT; @@ -2066,7 +2066,7 @@ again: if (!d_unhashed(dentry)) __d_drop(dentry); - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); fsnotify_nameremove(dentry, isdir); } @@ -2095,9 +2095,9 @@ static void _d_rehash(struct dentry * entry) void d_rehash(struct dentry * entry) { - spin_lock(&entry->d_lock); + seq_spin_lock(&entry->d_lock); _d_rehash(entry); - spin_unlock(&entry->d_lock); + seq_spin_unlock(&entry->d_lock); } EXPORT_SYMBOL(d_rehash); @@ -2120,11 +2120,9 @@ void dentry_update_name_case(struct dentry *dentry, struct qstr *name) BUG_ON(!mutex_is_locked(&dentry->d_parent->d_inode->i_mutex)); BUG_ON(dentry->d_name.len != name->len); /* d_lookup gives this */ - spin_lock(&dentry->d_lock); - write_seqcount_begin(&dentry->d_seq); + write_seqlock(&dentry->d_lock); memcpy((unsigned char *)dentry->d_name.name, name->name, name->len); - write_seqcount_end(&dentry->d_seq); - spin_unlock(&dentry->d_lock); + write_sequnlock(&dentry->d_lock); } EXPORT_SYMBOL(dentry_update_name_case); @@ -2175,24 +2173,24 @@ static void dentry_lock_for_move(struct dentry *dentry, struct dentry *target) * XXXX: do we really need to take target->d_lock? */ if (IS_ROOT(dentry) || dentry->d_parent == target->d_parent) - spin_lock(&target->d_parent->d_lock); + seq_spin_lock(&target->d_parent->d_lock); else { if (d_ancestor(dentry->d_parent, target->d_parent)) { - spin_lock(&dentry->d_parent->d_lock); - spin_lock_nested(&target->d_parent->d_lock, - DENTRY_D_LOCK_NESTED); + seq_spin_lock(&dentry->d_parent->d_lock); + seq_spin_lock_nested(&target->d_parent->d_lock, + DENTRY_D_LOCK_NESTED); } else { - spin_lock(&target->d_parent->d_lock); - spin_lock_nested(&dentry->d_parent->d_lock, - DENTRY_D_LOCK_NESTED); + seq_spin_lock(&target->d_parent->d_lock); + seq_spin_lock_nested(&dentry->d_parent->d_lock, + DENTRY_D_LOCK_NESTED); } } if (target < dentry) { - spin_lock_nested(&target->d_lock, 2); - spin_lock_nested(&dentry->d_lock, 3); + seq_spin_lock_nested(&target->d_lock, 2); + seq_spin_lock_nested(&dentry->d_lock, 3); } else { - spin_lock_nested(&dentry->d_lock, 2); - spin_lock_nested(&target->d_lock, 3); + seq_spin_lock_nested(&dentry->d_lock, 2); + seq_spin_lock_nested(&target->d_lock, 3); } } @@ -2200,9 +2198,9 @@ static void dentry_unlock_parents_for_move(struct dentry *dentry, struct dentry *target) { if (target->d_parent != dentry->d_parent) - spin_unlock(&dentry->d_parent->d_lock); + seq_spin_unlock(&dentry->d_parent->d_lock); if (target->d_parent != target) - spin_unlock(&target->d_parent->d_lock); + seq_spin_unlock(&target->d_parent->d_lock); } /* @@ -2235,8 +2233,8 @@ static void __d_move(struct dentry * dentry, struct dentry * target) dentry_lock_for_move(dentry, target); - write_seqcount_begin(&dentry->d_seq); - write_seqcount_begin(&target->d_seq); + write_seqlock_begin(&dentry->d_lock); + write_seqlock_begin(&target->d_lock); /* __d_drop does write_seqcount_barrier, but they're OK to nest. */ @@ -2271,13 +2269,13 @@ static void __d_move(struct dentry * dentry, struct dentry * target) list_add(&dentry->d_u.d_child, &dentry->d_parent->d_subdirs); - write_seqcount_end(&target->d_seq); - write_seqcount_end(&dentry->d_seq); + write_seqlock_end(&target->d_lock); + write_seqlock_end(&dentry->d_lock); dentry_unlock_parents_for_move(dentry, target); - spin_unlock(&target->d_lock); + seq_spin_unlock(&target->d_lock); fsnotify_d_move(dentry); - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); } /* @@ -2365,8 +2363,8 @@ static void __d_materialise_dentry(struct dentry *dentry, struct dentry *anon) dentry_lock_for_move(anon, dentry); - write_seqcount_begin(&dentry->d_seq); - write_seqcount_begin(&anon->d_seq); + write_seqlock_begin(&dentry->d_lock); + write_seqlock_begin(&anon->d_lock); dparent = dentry->d_parent; aparent = anon->d_parent; @@ -2388,11 +2386,11 @@ static void __d_materialise_dentry(struct dentry *dentry, struct dentry *anon) else INIT_LIST_HEAD(&anon->d_u.d_child); - write_seqcount_end(&dentry->d_seq); - write_seqcount_end(&anon->d_seq); + write_seqlock_end(&dentry->d_lock); + write_seqlock_end(&anon->d_lock); dentry_unlock_parents_for_move(anon, dentry); - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); /* anon->d_lock still locked, returns locked */ anon->d_flags &= ~DCACHE_DISCONNECTED; @@ -2460,10 +2458,10 @@ struct dentry *d_materialise_unique(struct dentry *dentry, struct inode *inode) else BUG_ON(!d_unhashed(actual)); - spin_lock(&actual->d_lock); + seq_spin_lock(&actual->d_lock); found: _d_rehash(actual); - spin_unlock(&actual->d_lock); + seq_spin_unlock(&actual->d_lock); spin_unlock(&inode->i_lock); out_nolock: if (actual == dentry) { @@ -2524,9 +2522,9 @@ static int prepend_path(const struct path *path, } parent = dentry->d_parent; prefetch(parent); - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); error = prepend_name(buffer, buflen, &dentry->d_name); - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); if (!error) error = prepend(buffer, buflen, "/", 1); if (error) @@ -2751,9 +2749,9 @@ static char *__dentry_path(struct dentry *dentry, char *buf, int buflen) int error; prefetch(parent); - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); error = prepend_name(&end, &buflen, &dentry->d_name); - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); if (error != 0 || prepend(&end, &buflen, "/", 1) != 0) goto Elong; @@ -2943,7 +2941,7 @@ void d_genocide(struct dentry *root) seq = read_seqbegin(&rename_lock); again: this_parent = root; - spin_lock(&this_parent->d_lock); + seq_spin_lock(&this_parent->d_lock); repeat: next = this_parent->d_subdirs.next; resume: @@ -2952,23 +2950,23 @@ resume: struct dentry *dentry = list_entry(tmp, struct dentry, d_u.d_child); next = tmp->next; - spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); + seq_spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); if (d_unhashed(dentry) || !dentry->d_inode) { - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); continue; } if (!list_empty(&dentry->d_subdirs)) { - spin_unlock(&this_parent->d_lock); - spin_release(&dentry->d_lock.dep_map, 1, _RET_IP_); + seq_spin_unlock(&this_parent->d_lock); + spin_release(&dentry->d_lock.lock.dep_map, 1, _RET_IP_); this_parent = dentry; - spin_acquire(&this_parent->d_lock.dep_map, 0, 1, _RET_IP_); + spin_acquire(&this_parent->d_lock.lock.dep_map, 0, 1, _RET_IP_); goto repeat; } if (!(dentry->d_flags & DCACHE_GENOCIDE)) { dentry->d_flags |= DCACHE_GENOCIDE; dentry->d_count--; } - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); } if (this_parent != root) { struct dentry *child = this_parent; @@ -2982,7 +2980,7 @@ resume: next = child->d_u.d_child.next; goto resume; } - spin_unlock(&this_parent->d_lock); + seq_spin_unlock(&this_parent->d_lock); if (!locked && read_seqretry(&rename_lock, seq)) goto rename_retry; if (locked) diff --git a/fs/dcookies.c b/fs/dcookies.c index dda0dc702d1b..3805e33f136c 100644 --- a/fs/dcookies.c +++ b/fs/dcookies.c @@ -98,9 +98,9 @@ static struct dcookie_struct *alloc_dcookie(struct path *path) return NULL; d = path->dentry; - spin_lock(&d->d_lock); + seq_spin_lock(&d->d_lock); d->d_flags |= DCACHE_COOKIE; - spin_unlock(&d->d_lock); + seq_spin_unlock(&d->d_lock); dcs->path = *path; path_get(path); @@ -267,9 +267,9 @@ static void free_dcookie(struct dcookie_struct * dcs) { struct dentry *d = dcs->path.dentry; - spin_lock(&d->d_lock); + seq_spin_lock(&d->d_lock); d->d_flags &= ~DCACHE_COOKIE; - spin_unlock(&d->d_lock); + seq_spin_unlock(&d->d_lock); path_put(&dcs->path); kmem_cache_free(dcookie_cache, dcs); diff --git a/fs/direct-io.c b/fs/direct-io.c index ac5f164170e3..91ea2116512e 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c @@ -255,7 +255,7 @@ static ssize_t dio_complete(struct dio *dio, loff_t offset, ssize_t ret, bool is if (dio->flags & DIO_LOCKING) /* lockdep: non-owner release */ - up_read_non_owner(&dio->inode->i_alloc_sem); + anon_up_read_non_owner(&dio->inode->i_alloc_sem); return ret; } @@ -1234,7 +1234,7 @@ __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, * Will be released at I/O completion, possibly in a * different thread. */ - down_read_non_owner(&inode->i_alloc_sem); + anon_down_read_non_owner(&inode->i_alloc_sem); } /* diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 35a852a2682f..a61de75d5bb2 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -464,12 +464,12 @@ static int ep_poll_wakeup_proc(void *priv, void *cookie, int call_nests) */ static void ep_poll_safewake(wait_queue_head_t *wq) { - int this_cpu = get_cpu(); + int this_cpu = get_cpu_light(); ep_call_nested(&poll_safewake_ncalls, EP_MAX_NESTS, ep_poll_wakeup_proc, NULL, wq, (void *) (long) this_cpu); - put_cpu(); + put_cpu_light(); } static void ep_remove_wait_queue(struct eppoll_entry *pwq) diff --git a/fs/exec.c b/fs/exec.c index 044c13ffdc42..3116940d84b8 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -844,6 +844,7 @@ static int exec_mmap(struct mm_struct *mm) } } task_lock(tsk); + local_irq_disable_rt(); active_mm = tsk->active_mm; tsk->mm = mm; tsk->active_mm = mm; @@ -852,6 +853,7 @@ static int exec_mmap(struct mm_struct *mm) atomic_dec(&old_mm->oom_disable_count); atomic_inc(&tsk->mm->oom_disable_count); } + local_irq_enable_rt(); task_unlock(tsk); arch_pick_mmap_layout(mm); if (old_mm) { @@ -1228,7 +1230,7 @@ int check_unsafe_exec(struct linux_binprm *bprm) bprm->unsafe = tracehook_unsafe_exec(p); n_fs = 1; - spin_lock(&p->fs->lock); + seq_spin_lock(&p->fs->lock); rcu_read_lock(); for (t = next_thread(p); t != p; t = next_thread(t)) { if (t->fs == p->fs) @@ -1245,7 +1247,7 @@ int check_unsafe_exec(struct linux_binprm *bprm) res = 1; } } - spin_unlock(&p->fs->lock); + seq_spin_unlock(&p->fs->lock); return res; } diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c index b05acb796135..4515886a5cbe 100644 --- a/fs/exportfs/expfs.c +++ b/fs/exportfs/expfs.c @@ -114,15 +114,15 @@ reconnect_path(struct vfsmount *mnt, struct dentry *target_dir, char *nbuf) if (!IS_ROOT(pd)) { /* must have found a connected parent - great */ - spin_lock(&pd->d_lock); + seq_spin_lock(&pd->d_lock); pd->d_flags &= ~DCACHE_DISCONNECTED; - spin_unlock(&pd->d_lock); + seq_spin_unlock(&pd->d_lock); noprogress = 0; } else if (pd == mnt->mnt_sb->s_root) { printk(KERN_ERR "export: Eeek filesystem root is not connected, impossible\n"); - spin_lock(&pd->d_lock); + seq_spin_lock(&pd->d_lock); pd->d_flags &= ~DCACHE_DISCONNECTED; - spin_unlock(&pd->d_lock); + seq_spin_unlock(&pd->d_lock); noprogress = 0; } else { /* @@ -335,11 +335,11 @@ static int export_encode_fh(struct dentry *dentry, struct fid *fid, if (connectable && !S_ISDIR(inode->i_mode)) { struct inode *parent; - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); parent = dentry->d_parent->d_inode; fid->i32.parent_ino = parent->i_ino; fid->i32.parent_gen = parent->i_generation; - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); len = 4; type = FILEID_INO32_GEN_PARENT; } diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index c1e6a7263893..0fb2874013b9 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -5888,7 +5888,7 @@ int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) * Get i_alloc_sem to stop truncates messing with the inode. We cannot * get i_mutex because we are already holding mmap_sem. */ - down_read(&inode->i_alloc_sem); + anon_down_read(&inode->i_alloc_sem); size = i_size_read(inode); if (page->mapping != mapping || size <= page_offset(page) || !PageUptodate(page)) { @@ -5900,7 +5900,7 @@ int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) lock_page(page); wait_on_page_writeback(page); if (PageMappedToDisk(page)) { - up_read(&inode->i_alloc_sem); + anon_up_read(&inode->i_alloc_sem); return VM_FAULT_LOCKED; } @@ -5918,7 +5918,7 @@ int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) if (page_has_buffers(page)) { if (!walk_page_buffers(NULL, page_buffers(page), 0, len, NULL, ext4_bh_unmapped)) { - up_read(&inode->i_alloc_sem); + anon_up_read(&inode->i_alloc_sem); return VM_FAULT_LOCKED; } } @@ -5947,11 +5947,11 @@ int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) */ lock_page(page); wait_on_page_writeback(page); - up_read(&inode->i_alloc_sem); + anon_up_read(&inode->i_alloc_sem); return VM_FAULT_LOCKED; out_unlock: if (ret) ret = VM_FAULT_SIGBUS; - up_read(&inode->i_alloc_sem); + anon_up_read(&inode->i_alloc_sem); return ret; } diff --git a/fs/fat/inode.c b/fs/fat/inode.c index cb8d8391ac0b..6df880df4fde 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c @@ -224,9 +224,9 @@ static sector_t _fat_bmap(struct address_space *mapping, sector_t block) sector_t blocknr; /* fat_get_cluster() assumes the requested blocknr isn't truncated. */ - down_read(&mapping->host->i_alloc_sem); + anon_down_read(&mapping->host->i_alloc_sem); blocknr = generic_block_bmap(mapping, block, fat_get_block); - up_read(&mapping->host->i_alloc_sem); + anon_up_read(&mapping->host->i_alloc_sem); return blocknr; } @@ -770,9 +770,9 @@ fat_encode_fh(struct dentry *de, __u32 *fh, int *lenp, int connectable) fh[1] = inode->i_generation; fh[2] = ipos_h; fh[3] = ipos_m | MSDOS_I(inode)->i_logstart; - spin_lock(&de->d_lock); + seq_spin_lock(&de->d_lock); fh[4] = ipos_l | MSDOS_I(de->d_parent->d_inode)->i_logstart; - spin_unlock(&de->d_lock); + seq_spin_unlock(&de->d_lock); return 3; } diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c index 20b4ea53fdc4..74a0c20beadb 100644 --- a/fs/fat/namei_vfat.c +++ b/fs/fat/namei_vfat.c @@ -34,10 +34,10 @@ static int vfat_revalidate_shortname(struct dentry *dentry) { int ret = 1; - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); if (dentry->d_time != dentry->d_parent->d_inode->i_version) ret = 0; - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); return ret; } diff --git a/fs/fhandle.c b/fs/fhandle.c index 6b088641f5bf..9f437acd28b2 100644 --- a/fs/fhandle.c +++ b/fs/fhandle.c @@ -115,10 +115,10 @@ static struct vfsmount *get_vfsmount_from_fd(int fd) if (fd == AT_FDCWD) { struct fs_struct *fs = current->fs; - spin_lock(&fs->lock); + seq_spin_lock(&fs->lock); path = fs->pwd; mntget(path.mnt); - spin_unlock(&fs->lock); + seq_spin_unlock(&fs->lock); } else { int fput_needed; struct file *file = fget_light(fd, &fput_needed); diff --git a/fs/file.c b/fs/file.c index 4c6992d8f3ba..fd0325842717 100644 --- a/fs/file.c +++ b/fs/file.c @@ -105,14 +105,14 @@ void free_fdtable_rcu(struct rcu_head *rcu) kfree(fdt->open_fds); kfree(fdt); } else { - fddef = &get_cpu_var(fdtable_defer_list); + fddef = &per_cpu(fdtable_defer_list, get_cpu_light()); spin_lock(&fddef->lock); fdt->next = fddef->next; fddef->next = fdt; /* vmallocs are handled from the workqueue context */ schedule_work(&fddef->wq); spin_unlock(&fddef->lock); - put_cpu_var(fdtable_defer_list); + put_cpu_light(); } } @@ -422,7 +422,7 @@ struct files_struct init_files = { .close_on_exec = (fd_set *)&init_files.close_on_exec_init, .open_fds = (fd_set *)&init_files.open_fds_init, }, - .file_lock = __SPIN_LOCK_UNLOCKED(init_task.file_lock), + .file_lock = __SPIN_LOCK_UNLOCKED(init_files.file_lock), }; /* diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index fe190a8b0bc8..50aed029e670 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -985,7 +985,7 @@ static noinline void block_dump___mark_inode_dirty(struct inode *inode) dentry = d_find_alias(inode); if (dentry) { - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); name = (const char *) dentry->d_name.name; } printk(KERN_DEBUG @@ -993,7 +993,7 @@ static noinline void block_dump___mark_inode_dirty(struct inode *inode) current->comm, task_pid_nr(current), inode->i_ino, name, inode->i_sb->s_id); if (dentry) { - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); dput(dentry); } } diff --git a/fs/fs_struct.c b/fs/fs_struct.c index 78b519c13536..84db5f1c6837 100644 --- a/fs/fs_struct.c +++ b/fs/fs_struct.c @@ -26,13 +26,11 @@ void set_fs_root(struct fs_struct *fs, struct path *path) { struct path old_root; - spin_lock(&fs->lock); - write_seqcount_begin(&fs->seq); + write_seqlock(&fs->lock); old_root = fs->root; fs->root = *path; path_get_longterm(path); - write_seqcount_end(&fs->seq); - spin_unlock(&fs->lock); + write_sequnlock(&fs->lock); if (old_root.dentry) path_put_longterm(&old_root); } @@ -45,13 +43,11 @@ void set_fs_pwd(struct fs_struct *fs, struct path *path) { struct path old_pwd; - spin_lock(&fs->lock); - write_seqcount_begin(&fs->seq); + write_seqlock(&fs->lock); old_pwd = fs->pwd; fs->pwd = *path; path_get_longterm(path); - write_seqcount_end(&fs->seq); - spin_unlock(&fs->lock); + write_sequnlock(&fs->lock); if (old_pwd.dentry) path_put_longterm(&old_pwd); @@ -68,8 +64,7 @@ void chroot_fs_refs(struct path *old_root, struct path *new_root) task_lock(p); fs = p->fs; if (fs) { - spin_lock(&fs->lock); - write_seqcount_begin(&fs->seq); + write_seqlock(&fs->lock); if (fs->root.dentry == old_root->dentry && fs->root.mnt == old_root->mnt) { path_get_longterm(new_root); @@ -82,8 +77,7 @@ void chroot_fs_refs(struct path *old_root, struct path *new_root) fs->pwd = *new_root; count++; } - write_seqcount_end(&fs->seq); - spin_unlock(&fs->lock); + write_sequnlock(&fs->lock); } task_unlock(p); } while_each_thread(g, p); @@ -106,12 +100,10 @@ void exit_fs(struct task_struct *tsk) if (fs) { int kill; task_lock(tsk); - spin_lock(&fs->lock); - write_seqcount_begin(&fs->seq); + write_seqlock(&fs->lock); tsk->fs = NULL; kill = !--fs->users; - write_seqcount_end(&fs->seq); - spin_unlock(&fs->lock); + write_sequnlock(&fs->lock); task_unlock(tsk); if (kill) free_fs_struct(fs); @@ -125,16 +117,15 @@ struct fs_struct *copy_fs_struct(struct fs_struct *old) if (fs) { fs->users = 1; fs->in_exec = 0; - spin_lock_init(&fs->lock); - seqcount_init(&fs->seq); + seqlock_init(&fs->lock); fs->umask = old->umask; - spin_lock(&old->lock); + seq_spin_lock(&old->lock); fs->root = old->root; path_get_longterm(&fs->root); fs->pwd = old->pwd; path_get_longterm(&fs->pwd); - spin_unlock(&old->lock); + seq_spin_unlock(&old->lock); } return fs; } @@ -149,10 +140,10 @@ int unshare_fs_struct(void) return -ENOMEM; task_lock(current); - spin_lock(&fs->lock); + seq_spin_lock(&fs->lock); kill = !--fs->users; current->fs = new_fs; - spin_unlock(&fs->lock); + seq_spin_unlock(&fs->lock); task_unlock(current); if (kill) @@ -171,8 +162,7 @@ EXPORT_SYMBOL(current_umask); /* to be mentioned only in INIT_TASK */ struct fs_struct init_fs = { .users = 1, - .lock = __SPIN_LOCK_UNLOCKED(init_fs.lock), - .seq = SEQCNT_ZERO, + .lock = __SEQLOCK_UNLOCKED(init_fs.lock), .umask = 0022, }; @@ -185,14 +175,14 @@ void daemonize_fs_struct(void) task_lock(current); - spin_lock(&init_fs.lock); + seq_spin_lock(&init_fs.lock); init_fs.users++; - spin_unlock(&init_fs.lock); + seq_spin_unlock(&init_fs.lock); - spin_lock(&fs->lock); + seq_spin_lock(&fs->lock); current->fs = &init_fs; kill = !--fs->users; - spin_unlock(&fs->lock); + seq_spin_unlock(&fs->lock); task_unlock(current); if (kill) diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 38f84cd48b67..77e6c1c08a91 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -652,11 +652,11 @@ static int fuse_encode_fh(struct dentry *dentry, u32 *fh, int *max_len, if (encode_parent) { struct inode *parent; - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); parent = dentry->d_parent->d_inode; nodeid = get_fuse_inode(parent)->nodeid; generation = parent->i_generation; - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); fh[3] = (u32)(nodeid >> 32); fh[4] = (u32)(nodeid & 0xffffffff); diff --git a/fs/gfs2/export.c b/fs/gfs2/export.c index fe9945f2ff72..dcc2f5a03ab8 100644 --- a/fs/gfs2/export.c +++ b/fs/gfs2/export.c @@ -53,11 +53,11 @@ static int gfs2_encode_fh(struct dentry *dentry, __u32 *p, int *len, if (!connectable || inode == sb->s_root->d_inode) return *len; - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); inode = dentry->d_parent->d_inode; ip = GFS2_I(inode); igrab(inode); - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); fh[4] = cpu_to_be32(ip->i_no_formal_ino >> 32); fh[5] = cpu_to_be32(ip->i_no_formal_ino & 0xFFFFFFFF); diff --git a/fs/inode.c b/fs/inode.c index 43566d17d1b8..731debdd5f20 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -176,7 +176,7 @@ int inode_init_always(struct super_block *sb, struct inode *inode) mutex_init(&inode->i_mutex); lockdep_set_class(&inode->i_mutex, &sb->s_type->i_mutex_key); - init_rwsem(&inode->i_alloc_sem); + init_anon_rwsem(&inode->i_alloc_sem); lockdep_set_class(&inode->i_alloc_sem, &sb->s_type->i_alloc_sem_key); mapping->a_ops = &empty_aops; diff --git a/fs/isofs/export.c b/fs/isofs/export.c index dd4687ff30d0..378505b7f9dc 100644 --- a/fs/isofs/export.c +++ b/fs/isofs/export.c @@ -139,13 +139,13 @@ isofs_export_encode_fh(struct dentry *dentry, if (connectable && !S_ISDIR(inode->i_mode)) { struct inode *parent; struct iso_inode_info *eparent; - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); parent = dentry->d_parent->d_inode; eparent = ISOFS_I(parent); fh32[3] = eparent->i_iget5_block; fh16[3] = (__u16)eparent->i_iget5_offset; /* fh16 [sic] */ fh32[4] = parent->i_generation; - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); len = 5; type = 2; } diff --git a/fs/libfs.c b/fs/libfs.c index 275ca4749a2e..b06c1a07d0c4 100644 --- a/fs/libfs.c +++ b/fs/libfs.c @@ -100,21 +100,21 @@ loff_t dcache_dir_lseek(struct file *file, loff_t offset, int origin) struct dentry *cursor = file->private_data; loff_t n = file->f_pos - 2; - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); /* d_lock not required for cursor */ list_del(&cursor->d_u.d_child); p = dentry->d_subdirs.next; while (n && p != &dentry->d_subdirs) { struct dentry *next; next = list_entry(p, struct dentry, d_u.d_child); - spin_lock_nested(&next->d_lock, DENTRY_D_LOCK_NESTED); + seq_spin_lock_nested(&next->d_lock, DENTRY_D_LOCK_NESTED); if (simple_positive(next)) n--; - spin_unlock(&next->d_lock); + seq_spin_unlock(&next->d_lock); p = p->next; } list_add_tail(&cursor->d_u.d_child, p); - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); } } mutex_unlock(&dentry->d_inode->i_mutex); @@ -157,35 +157,35 @@ int dcache_readdir(struct file * filp, void * dirent, filldir_t filldir) i++; /* fallthrough */ default: - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); if (filp->f_pos == 2) list_move(q, &dentry->d_subdirs); for (p=q->next; p != &dentry->d_subdirs; p=p->next) { struct dentry *next; next = list_entry(p, struct dentry, d_u.d_child); - spin_lock_nested(&next->d_lock, DENTRY_D_LOCK_NESTED); + seq_spin_lock_nested(&next->d_lock, DENTRY_D_LOCK_NESTED); if (!simple_positive(next)) { - spin_unlock(&next->d_lock); + seq_spin_unlock(&next->d_lock); continue; } - spin_unlock(&next->d_lock); - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&next->d_lock); + seq_spin_unlock(&dentry->d_lock); if (filldir(dirent, next->d_name.name, next->d_name.len, filp->f_pos, next->d_inode->i_ino, dt_type(next->d_inode)) < 0) return 0; - spin_lock(&dentry->d_lock); - spin_lock_nested(&next->d_lock, DENTRY_D_LOCK_NESTED); + seq_spin_lock(&dentry->d_lock); + seq_spin_lock_nested(&next->d_lock, DENTRY_D_LOCK_NESTED); /* next is still alive */ list_move(q, p); - spin_unlock(&next->d_lock); + seq_spin_unlock(&next->d_lock); p = q; filp->f_pos++; } - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); } return 0; } @@ -281,18 +281,18 @@ int simple_empty(struct dentry *dentry) struct dentry *child; int ret = 0; - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); list_for_each_entry(child, &dentry->d_subdirs, d_u.d_child) { - spin_lock_nested(&child->d_lock, DENTRY_D_LOCK_NESTED); + seq_spin_lock_nested(&child->d_lock, DENTRY_D_LOCK_NESTED); if (simple_positive(child)) { - spin_unlock(&child->d_lock); + seq_spin_unlock(&child->d_lock); goto out; } - spin_unlock(&child->d_lock); + seq_spin_unlock(&child->d_lock); } ret = 1; out: - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); return ret; } diff --git a/fs/namei.c b/fs/namei.c index 16bda6cd602d..e5aed523163c 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -424,12 +424,12 @@ static int unlazy_walk(struct nameidata *nd, struct dentry *dentry) BUG_ON(!(nd->flags & LOOKUP_RCU)); if (nd->root.mnt && !(nd->flags & LOOKUP_ROOT)) { want_root = 1; - spin_lock(&fs->lock); + seq_spin_lock(&fs->lock); if (nd->root.mnt != fs->root.mnt || nd->root.dentry != fs->root.dentry) goto err_root; } - spin_lock(&parent->d_lock); + seq_spin_lock(&parent->d_lock); if (!dentry) { if (!__d_rcu_to_refcount(parent, nd->seq)) goto err_parent; @@ -437,7 +437,7 @@ static int unlazy_walk(struct nameidata *nd, struct dentry *dentry) } else { if (dentry->d_parent != parent) goto err_parent; - spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); + seq_spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); if (!__d_rcu_to_refcount(dentry, nd->seq)) goto err_child; /* @@ -449,12 +449,12 @@ static int unlazy_walk(struct nameidata *nd, struct dentry *dentry) BUG_ON(!IS_ROOT(dentry) && dentry->d_parent != parent); BUG_ON(!parent->d_count); parent->d_count++; - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); } - spin_unlock(&parent->d_lock); + seq_spin_unlock(&parent->d_lock); if (want_root) { path_get(&nd->root); - spin_unlock(&fs->lock); + seq_spin_unlock(&fs->lock); } mntget(nd->path.mnt); @@ -464,12 +464,12 @@ static int unlazy_walk(struct nameidata *nd, struct dentry *dentry) return 0; err_child: - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); err_parent: - spin_unlock(&parent->d_lock); + seq_spin_unlock(&parent->d_lock); err_root: if (want_root) - spin_unlock(&fs->lock); + seq_spin_unlock(&fs->lock); return -ECHILD; } @@ -535,15 +535,15 @@ static int complete_walk(struct nameidata *nd) nd->flags &= ~LOOKUP_RCU; if (!(nd->flags & LOOKUP_ROOT)) nd->root.mnt = NULL; - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); if (unlikely(!__d_rcu_to_refcount(dentry, nd->seq))) { - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); rcu_read_unlock(); br_read_unlock(vfsmount_lock); return -ECHILD; } BUG_ON(nd->inode != dentry->d_inode); - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); mntget(nd->path.mnt); rcu_read_unlock(); br_read_unlock(vfsmount_lock); @@ -619,10 +619,10 @@ static __always_inline void set_root_rcu(struct nameidata *nd) unsigned seq; do { - seq = read_seqcount_begin(&fs->seq); + seq = read_seqbegin(&fs->lock); nd->root = fs->root; - nd->seq = __read_seqcount_begin(&nd->root.dentry->d_seq); - } while (read_seqcount_retry(&fs->seq, seq)); + nd->seq = __read_seqbegin(&nd->root.dentry->d_lock); + } while (read_seqretry(&fs->lock, seq)); } } @@ -959,7 +959,7 @@ static bool __follow_mount_rcu(struct nameidata *nd, struct path *path, path->mnt = mounted; path->dentry = mounted->mnt_root; nd->flags |= LOOKUP_JUMPED; - nd->seq = read_seqcount_begin(&path->dentry->d_seq); + nd->seq = read_seqbegin(&path->dentry->d_lock); /* * Update the inode too. We don't need to re-check the * dentry sequence number here after this d_inode read, @@ -979,7 +979,7 @@ static void follow_mount_rcu(struct nameidata *nd) break; nd->path.mnt = mounted; nd->path.dentry = mounted->mnt_root; - nd->seq = read_seqcount_begin(&nd->path.dentry->d_seq); + nd->seq = read_seqbegin(&nd->path.dentry->d_lock); } } @@ -997,8 +997,8 @@ static int follow_dotdot_rcu(struct nameidata *nd) struct dentry *parent = old->d_parent; unsigned seq; - seq = read_seqcount_begin(&parent->d_seq); - if (read_seqcount_retry(&old->d_seq, nd->seq)) + seq = read_seqbegin(&parent->d_lock); + if (read_seqretry(&old->d_lock, nd->seq)) goto failed; nd->path.dentry = parent; nd->seq = seq; @@ -1006,7 +1006,7 @@ static int follow_dotdot_rcu(struct nameidata *nd) } if (!follow_up_rcu(&nd->path)) break; - nd->seq = read_seqcount_begin(&nd->path.dentry->d_seq); + nd->seq = read_seqbegin(&nd->path.dentry->d_lock); } follow_mount_rcu(nd); nd->inode = nd->path.dentry->d_inode; @@ -1166,7 +1166,7 @@ static int do_lookup(struct nameidata *nd, struct qstr *name, goto unlazy; /* Memory barrier in read_seqcount_begin of child is enough */ - if (__read_seqcount_retry(&parent->d_seq, nd->seq)) + if (__read_seqretry(&parent->d_lock, nd->seq)) return -ECHILD; nd->seq = seq; @@ -1473,7 +1473,7 @@ static int path_init(int dfd, const char *name, unsigned int flags, if (flags & LOOKUP_RCU) { br_read_lock(vfsmount_lock); rcu_read_lock(); - nd->seq = __read_seqcount_begin(&nd->path.dentry->d_seq); + nd->seq = __read_seqbegin(&nd->path.dentry->d_lock); } else { path_get(&nd->path); } @@ -1501,10 +1501,10 @@ static int path_init(int dfd, const char *name, unsigned int flags, rcu_read_lock(); do { - seq = read_seqcount_begin(&fs->seq); + seq = read_seqbegin(&fs->lock); nd->path = fs->pwd; - nd->seq = __read_seqcount_begin(&nd->path.dentry->d_seq); - } while (read_seqcount_retry(&fs->seq, seq)); + nd->seq = __read_seqbegin(&nd->path.dentry->d_lock); + } while (read_seqretry(&fs->lock, seq)); } else { get_fs_pwd(current->fs, &nd->path); } @@ -1532,7 +1532,7 @@ static int path_init(int dfd, const char *name, unsigned int flags, if (flags & LOOKUP_RCU) { if (fput_needed) *fp = file; - nd->seq = __read_seqcount_begin(&nd->path.dentry->d_seq); + nd->seq = __read_seqbegin(&nd->path.dentry->d_lock); br_read_lock(vfsmount_lock); rcu_read_lock(); } else { @@ -2591,10 +2591,10 @@ SYSCALL_DEFINE2(mkdir, const char __user *, pathname, int, mode) void dentry_unhash(struct dentry *dentry) { shrink_dcache_parent(dentry); - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); if (dentry->d_count == 1) __d_drop(dentry); - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); } int vfs_rmdir(struct inode *dir, struct dentry *dentry) diff --git a/fs/namespace.c b/fs/namespace.c index edc1c4aef757..3270cdedfecb 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -31,6 +31,7 @@ #include <linux/idr.h> #include <linux/fs_struct.h> #include <linux/fsnotify.h> +#include <linux/delay.h> #include <asm/uaccess.h> #include <asm/unistd.h> #include "pnode.h" @@ -341,8 +342,14 @@ int mnt_want_write(struct vfsmount *mnt) * incremented count after it has set MNT_WRITE_HOLD. */ smp_mb(); - while (mnt->mnt_flags & MNT_WRITE_HOLD) - cpu_relax(); + /* + * No need to keep preemption disabled accross the spin loop. + */ + while (mnt->mnt_flags & MNT_WRITE_HOLD) { + preempt_enable(); + cpu_chill(); + preempt_disable(); + } /* * After the slowpath clears MNT_WRITE_HOLD, mnt_is_readonly will * be set to match its requirements. So we must not load that until @@ -352,9 +359,7 @@ int mnt_want_write(struct vfsmount *mnt) if (__mnt_is_readonly(mnt)) { mnt_dec_writers(mnt); ret = -EROFS; - goto out; } -out: preempt_enable(); return ret; } @@ -560,9 +565,9 @@ static void dentry_reset_mounted(struct vfsmount *mnt, struct dentry *dentry) return; } } - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); dentry->d_flags &= ~DCACHE_MOUNTED; - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); } /* @@ -587,9 +592,9 @@ void mnt_set_mountpoint(struct vfsmount *mnt, struct dentry *dentry, { child_mnt->mnt_parent = mntget(mnt); child_mnt->mnt_mountpoint = dget(dentry); - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); dentry->d_flags |= DCACHE_MOUNTED; - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); } /* diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c index 9c51f621e901..3c7d06908e02 100644 --- a/fs/ncpfs/dir.c +++ b/fs/ncpfs/dir.c @@ -388,7 +388,7 @@ ncp_dget_fpos(struct dentry *dentry, struct dentry *parent, unsigned long fpos) } /* If a pointer is invalid, we search the dentry. */ - spin_lock(&parent->d_lock); + seq_spin_lock(&parent->d_lock); next = parent->d_subdirs.next; while (next != &parent->d_subdirs) { dent = list_entry(next, struct dentry, d_u.d_child); @@ -397,12 +397,12 @@ ncp_dget_fpos(struct dentry *dentry, struct dentry *parent, unsigned long fpos) dget(dent); else dent = NULL; - spin_unlock(&parent->d_lock); + seq_spin_unlock(&parent->d_lock); goto out; } next = next->next; } - spin_unlock(&parent->d_lock); + seq_spin_unlock(&parent->d_lock); return NULL; out: diff --git a/fs/ncpfs/ncplib_kernel.h b/fs/ncpfs/ncplib_kernel.h index 09881e6aa5ad..d9ac5e5e337b 100644 --- a/fs/ncpfs/ncplib_kernel.h +++ b/fs/ncpfs/ncplib_kernel.h @@ -191,7 +191,7 @@ ncp_renew_dentries(struct dentry *parent) struct list_head *next; struct dentry *dentry; - spin_lock(&parent->d_lock); + seq_spin_lock(&parent->d_lock); next = parent->d_subdirs.next; while (next != &parent->d_subdirs) { dentry = list_entry(next, struct dentry, d_u.d_child); @@ -203,7 +203,7 @@ ncp_renew_dentries(struct dentry *parent) next = next->next; } - spin_unlock(&parent->d_lock); + seq_spin_unlock(&parent->d_lock); } static inline void @@ -213,7 +213,7 @@ ncp_invalidate_dircache_entries(struct dentry *parent) struct list_head *next; struct dentry *dentry; - spin_lock(&parent->d_lock); + seq_spin_lock(&parent->d_lock); next = parent->d_subdirs.next; while (next != &parent->d_subdirs) { dentry = list_entry(next, struct dentry, d_u.d_child); @@ -221,7 +221,7 @@ ncp_invalidate_dircache_entries(struct dentry *parent) ncp_age_dentry(server, dentry); next = next->next; } - spin_unlock(&parent->d_lock); + seq_spin_unlock(&parent->d_lock); } struct ncp_cache_head { diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 462a00601737..e0ce56661012 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -1813,9 +1813,9 @@ static int nfs_unlink(struct inode *dir, struct dentry *dentry) dfprintk(VFS, "NFS: unlink(%s/%ld, %s)\n", dir->i_sb->s_id, dir->i_ino, dentry->d_name.name); - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); if (dentry->d_count > 1) { - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); /* Start asynchronous writeout of the inode */ write_inode_now(dentry->d_inode, 0); error = nfs_sillyrename(dir, dentry); @@ -1825,7 +1825,7 @@ static int nfs_unlink(struct inode *dir, struct dentry *dentry) __d_drop(dentry); need_rehash = 1; } - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); error = nfs_safe_remove(dentry); if (!error || error == -ENOENT) { nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); diff --git a/fs/nfs/getroot.c b/fs/nfs/getroot.c index dcb61548887f..02ecd4dd15cd 100644 --- a/fs/nfs/getroot.c +++ b/fs/nfs/getroot.c @@ -64,9 +64,9 @@ static int nfs_superblock_set_dummy_root(struct super_block *sb, struct inode *i * Oops, since the test for IS_ROOT() will fail. */ spin_lock(&sb->s_root->d_inode->i_lock); - spin_lock(&sb->s_root->d_lock); + seq_spin_lock(&sb->s_root->d_lock); list_del_init(&sb->s_root->d_alias); - spin_unlock(&sb->s_root->d_lock); + seq_spin_unlock(&sb->s_root->d_lock); spin_unlock(&sb->s_root->d_inode->i_lock); } return 0; @@ -126,12 +126,12 @@ struct dentry *nfs_get_root(struct super_block *sb, struct nfs_fh *mntfh, } security_d_instantiate(ret, inode); - spin_lock(&ret->d_lock); + seq_spin_lock(&ret->d_lock); if (IS_ROOT(ret) && !(ret->d_flags & DCACHE_NFSFS_RENAMED)) { ret->d_fsdata = name; name = NULL; } - spin_unlock(&ret->d_lock); + seq_spin_unlock(&ret->d_lock); out: if (name) kfree(name); @@ -250,12 +250,12 @@ struct dentry *nfs4_get_root(struct super_block *sb, struct nfs_fh *mntfh, } security_d_instantiate(ret, inode); - spin_lock(&ret->d_lock); + seq_spin_lock(&ret->d_lock); if (IS_ROOT(ret) && !(ret->d_flags & DCACHE_NFSFS_RENAMED)) { ret->d_fsdata = name; name = NULL; } - spin_unlock(&ret->d_lock); + seq_spin_unlock(&ret->d_lock); out: if (name) kfree(name); diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c index 1f063bacd285..4b3ffaa454bb 100644 --- a/fs/nfs/namespace.c +++ b/fs/nfs/namespace.c @@ -60,7 +60,7 @@ rename_retry: seq = read_seqbegin(&rename_lock); rcu_read_lock(); while (1) { - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); if (IS_ROOT(dentry)) break; namelen = dentry->d_name.len; @@ -70,17 +70,17 @@ rename_retry: end -= namelen; memcpy(end, dentry->d_name.name, namelen); *--end = '/'; - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); dentry = dentry->d_parent; } if (read_seqretry(&rename_lock, seq)) { - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); rcu_read_unlock(); goto rename_retry; } if (*end != '/') { if (--buflen < 0) { - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); rcu_read_unlock(); goto Elong; } @@ -89,7 +89,7 @@ rename_retry: *p = end; base = dentry->d_fsdata; if (!base) { - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); rcu_read_unlock(); WARN_ON(1); return end; @@ -100,17 +100,17 @@ rename_retry: namelen--; buflen -= namelen; if (buflen < 0) { - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); rcu_read_unlock(); goto Elong; } end -= namelen; memcpy(end, base, namelen); - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); rcu_read_unlock(); return end; Elong_unlock: - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); rcu_read_unlock(); if (read_seqretry(&rename_lock, seq)) goto rename_retry; diff --git a/fs/nfs/unlink.c b/fs/nfs/unlink.c index 8d6864c2a5fa..5d2740d4faea 100644 --- a/fs/nfs/unlink.c +++ b/fs/nfs/unlink.c @@ -155,7 +155,7 @@ static int nfs_do_call_unlink(struct dentry *parent, struct inode *dir, struct n * the sillyrename information to the aliased dentry. */ nfs_free_dname(data); - spin_lock(&alias->d_lock); + seq_spin_lock(&alias->d_lock); if (alias->d_inode != NULL && !(alias->d_flags & DCACHE_NFSFS_RENAMED)) { devname_garbage = alias->d_fsdata; @@ -163,7 +163,7 @@ static int nfs_do_call_unlink(struct dentry *parent, struct inode *dir, struct n alias->d_flags |= DCACHE_NFSFS_RENAMED; ret = 1; } - spin_unlock(&alias->d_lock); + seq_spin_unlock(&alias->d_lock); nfs_dec_sillycount(dir); dput(alias); /* @@ -275,13 +275,13 @@ nfs_async_unlink(struct inode *dir, struct dentry *dentry) data->res.dir_attr = &data->dir_attr; status = -EBUSY; - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); if (dentry->d_flags & DCACHE_NFSFS_RENAMED) goto out_unlock; dentry->d_flags |= DCACHE_NFSFS_RENAMED; devname_garbage = dentry->d_fsdata; dentry->d_fsdata = data; - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); /* * If we'd displaced old cached devname, free it. At that * point dentry is definitely not a root, so we won't need @@ -291,7 +291,7 @@ nfs_async_unlink(struct inode *dir, struct dentry *dentry) kfree(devname_garbage); return 0; out_unlock: - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); put_rpccred(data->cred); out_free: kfree(data); @@ -313,13 +313,13 @@ nfs_complete_unlink(struct dentry *dentry, struct inode *inode) { struct nfs_unlinkdata *data = NULL; - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); if (dentry->d_flags & DCACHE_NFSFS_RENAMED) { dentry->d_flags &= ~DCACHE_NFSFS_RENAMED; data = dentry->d_fsdata; dentry->d_fsdata = NULL; } - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); if (data != NULL && (NFS_STALE(inode) || !nfs_call_unlink(dentry, data))) nfs_free_unlinkdata(data); @@ -329,17 +329,17 @@ nfs_complete_unlink(struct dentry *dentry, struct inode *inode) static void nfs_cancel_async_unlink(struct dentry *dentry) { - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); if (dentry->d_flags & DCACHE_NFSFS_RENAMED) { struct nfs_unlinkdata *data = dentry->d_fsdata; dentry->d_flags &= ~DCACHE_NFSFS_RENAMED; dentry->d_fsdata = NULL; - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); nfs_free_unlinkdata(data); return; } - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); } struct nfs_renamedata { diff --git a/fs/nilfs2/namei.c b/fs/nilfs2/namei.c index 546849b3e88f..e068a6637648 100644 --- a/fs/nilfs2/namei.c +++ b/fs/nilfs2/namei.c @@ -543,11 +543,11 @@ static int nilfs_encode_fh(struct dentry *dentry, __u32 *fh, int *lenp, if (connectable && !S_ISDIR(inode->i_mode)) { struct inode *parent; - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); parent = dentry->d_parent->d_inode; fid->parent_ino = parent->i_ino; fid->parent_gen = parent->i_generation; - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); type = FILEID_NILFS_WITH_PARENT; *lenp = NILFS_FID_SIZE_CONNECTABLE; diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c index 79b47cbb5cd8..f3c5bd557a8a 100644 --- a/fs/notify/fsnotify.c +++ b/fs/notify/fsnotify.c @@ -68,19 +68,19 @@ void __fsnotify_update_child_dentry_flags(struct inode *inode) /* run all of the children of the original inode and fix their * d_flags to indicate parental interest (their parent is the * original inode) */ - spin_lock(&alias->d_lock); + seq_spin_lock(&alias->d_lock); list_for_each_entry(child, &alias->d_subdirs, d_u.d_child) { if (!child->d_inode) continue; - spin_lock_nested(&child->d_lock, DENTRY_D_LOCK_NESTED); + seq_spin_lock_nested(&child->d_lock, DENTRY_D_LOCK_NESTED); if (watched) child->d_flags |= DCACHE_FSNOTIFY_PARENT_WATCHED; else child->d_flags &= ~DCACHE_FSNOTIFY_PARENT_WATCHED; - spin_unlock(&child->d_lock); + seq_spin_unlock(&child->d_lock); } - spin_unlock(&alias->d_lock); + seq_spin_unlock(&alias->d_lock); } spin_unlock(&inode->i_lock); } diff --git a/fs/notify/vfsmount_mark.c b/fs/notify/vfsmount_mark.c index e86577d6c5c3..2384a346a5bd 100644 --- a/fs/notify/vfsmount_mark.c +++ b/fs/notify/vfsmount_mark.c @@ -35,13 +35,13 @@ void fsnotify_clear_marks_by_mount(struct vfsmount *mnt) struct hlist_node *pos, *n; LIST_HEAD(free_list); - spin_lock(&mnt->mnt_root->d_lock); + seq_spin_lock(&mnt->mnt_root->d_lock); hlist_for_each_entry_safe(mark, pos, n, &mnt->mnt_fsnotify_marks, m.m_list) { list_add(&mark->m.free_m_list, &free_list); hlist_del_init_rcu(&mark->m.m_list); fsnotify_get_mark(mark); } - spin_unlock(&mnt->mnt_root->d_lock); + seq_spin_unlock(&mnt->mnt_root->d_lock); list_for_each_entry_safe(mark, lmark, &free_list, m.free_m_list) { fsnotify_destroy_mark(mark); @@ -63,7 +63,7 @@ static void fsnotify_recalc_vfsmount_mask_locked(struct vfsmount *mnt) struct hlist_node *pos; __u32 new_mask = 0; - assert_spin_locked(&mnt->mnt_root->d_lock); + assert_seq_spin_locked(&mnt->mnt_root->d_lock); hlist_for_each_entry(mark, pos, &mnt->mnt_fsnotify_marks, m.m_list) new_mask |= mark->mask; @@ -76,9 +76,9 @@ static void fsnotify_recalc_vfsmount_mask_locked(struct vfsmount *mnt) */ void fsnotify_recalc_vfsmount_mask(struct vfsmount *mnt) { - spin_lock(&mnt->mnt_root->d_lock); + seq_spin_lock(&mnt->mnt_root->d_lock); fsnotify_recalc_vfsmount_mask_locked(mnt); - spin_unlock(&mnt->mnt_root->d_lock); + seq_spin_unlock(&mnt->mnt_root->d_lock); } void fsnotify_destroy_vfsmount_mark(struct fsnotify_mark *mark) @@ -88,14 +88,14 @@ void fsnotify_destroy_vfsmount_mark(struct fsnotify_mark *mark) assert_spin_locked(&mark->lock); assert_spin_locked(&mark->group->mark_lock); - spin_lock(&mnt->mnt_root->d_lock); + seq_spin_lock(&mnt->mnt_root->d_lock); hlist_del_init_rcu(&mark->m.m_list); mark->m.mnt = NULL; fsnotify_recalc_vfsmount_mask_locked(mnt); - spin_unlock(&mnt->mnt_root->d_lock); + seq_spin_unlock(&mnt->mnt_root->d_lock); } static struct fsnotify_mark *fsnotify_find_vfsmount_mark_locked(struct fsnotify_group *group, @@ -104,7 +104,7 @@ static struct fsnotify_mark *fsnotify_find_vfsmount_mark_locked(struct fsnotify_ struct fsnotify_mark *mark; struct hlist_node *pos; - assert_spin_locked(&mnt->mnt_root->d_lock); + assert_seq_spin_locked(&mnt->mnt_root->d_lock); hlist_for_each_entry(mark, pos, &mnt->mnt_fsnotify_marks, m.m_list) { if (mark->group == group) { @@ -124,9 +124,9 @@ struct fsnotify_mark *fsnotify_find_vfsmount_mark(struct fsnotify_group *group, { struct fsnotify_mark *mark; - spin_lock(&mnt->mnt_root->d_lock); + seq_spin_lock(&mnt->mnt_root->d_lock); mark = fsnotify_find_vfsmount_mark_locked(group, mnt); - spin_unlock(&mnt->mnt_root->d_lock); + seq_spin_unlock(&mnt->mnt_root->d_lock); return mark; } @@ -149,7 +149,7 @@ int fsnotify_add_vfsmount_mark(struct fsnotify_mark *mark, assert_spin_locked(&mark->lock); assert_spin_locked(&group->mark_lock); - spin_lock(&mnt->mnt_root->d_lock); + seq_spin_lock(&mnt->mnt_root->d_lock); mark->m.mnt = mnt; @@ -184,7 +184,7 @@ int fsnotify_add_vfsmount_mark(struct fsnotify_mark *mark, hlist_add_after_rcu(last, &mark->m.m_list); out: fsnotify_recalc_vfsmount_mask_locked(mnt); - spin_unlock(&mnt->mnt_root->d_lock); + seq_spin_unlock(&mnt->mnt_root->d_lock); return ret; } diff --git a/fs/ntfs/aops.c b/fs/ntfs/aops.c index 0b1e885b8cf8..4c8095c6544f 100644 --- a/fs/ntfs/aops.c +++ b/fs/ntfs/aops.c @@ -108,8 +108,7 @@ static void ntfs_end_buffer_async_read(struct buffer_head *bh, int uptodate) "0x%llx.", (unsigned long long)bh->b_blocknr); } first = page_buffers(page); - local_irq_save(flags); - bit_spin_lock(BH_Uptodate_Lock, &first->b_state); + flags = bh_uptodate_lock_irqsave(first); clear_buffer_async_read(bh); unlock_buffer(bh); tmp = bh; @@ -124,8 +123,7 @@ static void ntfs_end_buffer_async_read(struct buffer_head *bh, int uptodate) } tmp = tmp->b_this_page; } while (tmp != bh); - bit_spin_unlock(BH_Uptodate_Lock, &first->b_state); - local_irq_restore(flags); + bh_uptodate_unlock_irqrestore(first, flags); /* * If none of the buffers had errors then we can set the page uptodate, * but we first have to perform the post read mst fixups, if the @@ -146,13 +144,13 @@ static void ntfs_end_buffer_async_read(struct buffer_head *bh, int uptodate) recs = PAGE_CACHE_SIZE / rec_size; /* Should have been verified before we got here... */ BUG_ON(!recs); - local_irq_save(flags); + local_irq_save_nort(flags); kaddr = kmap_atomic(page, KM_BIO_SRC_IRQ); for (i = 0; i < recs; i++) post_read_mst_fixup((NTFS_RECORD*)(kaddr + i * rec_size), rec_size); kunmap_atomic(kaddr, KM_BIO_SRC_IRQ); - local_irq_restore(flags); + local_irq_restore_nort(flags); flush_dcache_page(page); if (likely(page_uptodate && !PageError(page))) SetPageUptodate(page); @@ -160,9 +158,7 @@ static void ntfs_end_buffer_async_read(struct buffer_head *bh, int uptodate) unlock_page(page); return; still_busy: - bit_spin_unlock(BH_Uptodate_Lock, &first->b_state); - local_irq_restore(flags); - return; + bh_uptodate_unlock_irqrestore(first, flags); } /** diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c index f4b1057abdd2..fbd909356d51 100644 --- a/fs/ntfs/file.c +++ b/fs/ntfs/file.c @@ -1832,9 +1832,9 @@ static ssize_t ntfs_file_buffered_write(struct kiocb *iocb, * fails again. */ if (unlikely(NInoTruncateFailed(ni))) { - down_write(&vi->i_alloc_sem); + anon_down_write(&vi->i_alloc_sem); err = ntfs_truncate(vi); - up_write(&vi->i_alloc_sem); + anon_up_write(&vi->i_alloc_sem); if (err || NInoTruncateFailed(ni)) { if (!err) err = -EIO; diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c index ac97bca282d2..1c679a957a4d 100644 --- a/fs/ocfs2/aops.c +++ b/fs/ocfs2/aops.c @@ -569,7 +569,7 @@ static void ocfs2_dio_end_io(struct kiocb *iocb, BUG_ON(!ocfs2_iocb_is_rw_locked(iocb)); if (ocfs2_iocb_is_sem_locked(iocb)) { - up_read(&inode->i_alloc_sem); + anon_up_read(&inode->i_alloc_sem); ocfs2_iocb_clear_sem_locked(iocb); } diff --git a/fs/ocfs2/dcache.c b/fs/ocfs2/dcache.c index e5ba34818332..d59a4c774b11 100644 --- a/fs/ocfs2/dcache.c +++ b/fs/ocfs2/dcache.c @@ -177,16 +177,16 @@ struct dentry *ocfs2_find_local_alias(struct inode *inode, list_for_each(p, &inode->i_dentry) { dentry = list_entry(p, struct dentry, d_alias); - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); if (ocfs2_match_dentry(dentry, parent_blkno, skip_unhashed)) { trace_ocfs2_find_local_alias(dentry->d_name.len, dentry->d_name.name); dget_dlock(dentry); - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); break; } - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); dentry = NULL; } diff --git a/fs/ocfs2/export.c b/fs/ocfs2/export.c index 745db42528d5..b48fa5295b6c 100644 --- a/fs/ocfs2/export.c +++ b/fs/ocfs2/export.c @@ -214,7 +214,7 @@ static int ocfs2_encode_fh(struct dentry *dentry, u32 *fh_in, int *max_len, if (connectable && !S_ISDIR(inode->i_mode)) { struct inode *parent; - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); parent = dentry->d_parent->d_inode; blkno = OCFS2_I(parent)->ip_blkno; @@ -224,7 +224,7 @@ static int ocfs2_encode_fh(struct dentry *dentry, u32 *fh_in, int *max_len, fh[4] = cpu_to_le32((u32)(blkno & 0xffffffff)); fh[5] = cpu_to_le32(generation); - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); len = 6; type = 2; diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index b1e35a392ca5..c26eafe5f000 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c @@ -2238,7 +2238,7 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb, relock: /* to match setattr's i_mutex -> i_alloc_sem -> rw_lock ordering */ if (direct_io) { - down_read(&inode->i_alloc_sem); + anon_down_read(&inode->i_alloc_sem); have_alloc_sem = 1; /* communicate with ocfs2_dio_end_io */ ocfs2_iocb_set_sem_locked(iocb); @@ -2290,7 +2290,7 @@ relock: */ if (direct_io && !can_do_direct) { ocfs2_rw_unlock(inode, rw_level); - up_read(&inode->i_alloc_sem); + anon_up_read(&inode->i_alloc_sem); have_alloc_sem = 0; rw_level = -1; @@ -2379,7 +2379,7 @@ out: out_sems: if (have_alloc_sem) { - up_read(&inode->i_alloc_sem); + anon_up_read(&inode->i_alloc_sem); ocfs2_iocb_clear_sem_locked(iocb); } @@ -2531,7 +2531,7 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb, * need locks to protect pending reads from racing with truncate. */ if (filp->f_flags & O_DIRECT) { - down_read(&inode->i_alloc_sem); + anon_down_read(&inode->i_alloc_sem); have_alloc_sem = 1; ocfs2_iocb_set_sem_locked(iocb); @@ -2575,7 +2575,7 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb, bail: if (have_alloc_sem) { - up_read(&inode->i_alloc_sem); + anon_up_read(&inode->i_alloc_sem); ocfs2_iocb_clear_sem_locked(iocb); } if (rw_level != -1) diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index 4fd5bb33dbb5..8307f1520a9d 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c @@ -1609,7 +1609,7 @@ int reiserfs_encode_fh(struct dentry *dentry, __u32 * data, int *lenp, if (maxlen < 5 || !need_parent) return 3; - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); inode = dentry->d_parent->d_inode; data[3] = inode->i_ino; data[4] = le32_to_cpu(INODE_PKEY(inode)->k_dir_id); @@ -1618,7 +1618,7 @@ int reiserfs_encode_fh(struct dentry *dentry, __u32 * data, int *lenp, data[5] = inode->i_generation; *lenp = 6; } - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); return *lenp; } diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c index d78089690965..1446033de173 100644 --- a/fs/reiserfs/xattr.c +++ b/fs/reiserfs/xattr.c @@ -555,11 +555,11 @@ reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *th, reiserfs_write_unlock(inode->i_sb); mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_XATTR); - down_write(&dentry->d_inode->i_alloc_sem); + anon_down_write(&dentry->d_inode->i_alloc_sem); reiserfs_write_lock(inode->i_sb); err = reiserfs_setattr(dentry, &newattrs); - up_write(&dentry->d_inode->i_alloc_sem); + anon_up_write(&dentry->d_inode->i_alloc_sem); mutex_unlock(&dentry->d_inode->i_mutex); } else update_ctime(inode); diff --git a/fs/timerfd.c b/fs/timerfd.c index dffeb3795af1..57f0e4e86f0a 100644 --- a/fs/timerfd.c +++ b/fs/timerfd.c @@ -313,7 +313,7 @@ SYSCALL_DEFINE4(timerfd_settime, int, ufd, int, flags, if (hrtimer_try_to_cancel(&ctx->tmr) >= 0) break; spin_unlock_irq(&ctx->wqh.lock); - cpu_relax(); + hrtimer_wait_for_timer(&ctx->tmr); } /* diff --git a/fs/udf/namei.c b/fs/udf/namei.c index f1dce848ef96..e2487a0bd5ef 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c @@ -1300,13 +1300,13 @@ static int udf_encode_fh(struct dentry *de, __u32 *fh, int *lenp, fid->udf.generation = inode->i_generation; if (connectable && !S_ISDIR(inode->i_mode)) { - spin_lock(&de->d_lock); + seq_spin_lock(&de->d_lock); inode = de->d_parent->d_inode; location = UDF_I(inode)->i_location; fid->udf.parent_block = location.logicalBlockNum; fid->udf.parent_partref = location.partitionReferenceNum; fid->udf.parent_generation = inode->i_generation; - spin_unlock(&de->d_lock); + seq_spin_unlock(&de->d_lock); *lenp = 5; type = FILEID_UDF_WITH_PARENT; } diff --git a/fs/xfs/linux-2.6/mrlock.h b/fs/xfs/linux-2.6/mrlock.h index ff6a19873e5c..c2f701724bba 100644 --- a/fs/xfs/linux-2.6/mrlock.h +++ b/fs/xfs/linux-2.6/mrlock.h @@ -21,18 +21,18 @@ #include <linux/rwsem.h> typedef struct { - struct rw_semaphore mr_lock; + struct rw_anon_semaphore mr_lock; #ifdef DEBUG - int mr_writer; + int mr_writer; #endif } mrlock_t; #ifdef DEBUG #define mrinit(mrp, name) \ - do { (mrp)->mr_writer = 0; init_rwsem(&(mrp)->mr_lock); } while (0) + do { (mrp)->mr_writer = 0; init_anon_rwsem(&(mrp)->mr_lock); } while (0) #else #define mrinit(mrp, name) \ - do { init_rwsem(&(mrp)->mr_lock); } while (0) + do { init_anon_rwsem(&(mrp)->mr_lock); } while (0) #endif #define mrlock_init(mrp, t,n,s) mrinit(mrp, n) @@ -40,12 +40,12 @@ typedef struct { static inline void mraccess_nested(mrlock_t *mrp, int subclass) { - down_read_nested(&mrp->mr_lock, subclass); + anon_down_read_nested(&mrp->mr_lock, subclass); } static inline void mrupdate_nested(mrlock_t *mrp, int subclass) { - down_write_nested(&mrp->mr_lock, subclass); + anon_down_write_nested(&mrp->mr_lock, subclass); #ifdef DEBUG mrp->mr_writer = 1; #endif @@ -53,12 +53,12 @@ static inline void mrupdate_nested(mrlock_t *mrp, int subclass) static inline int mrtryaccess(mrlock_t *mrp) { - return down_read_trylock(&mrp->mr_lock); + return anon_down_read_trylock(&mrp->mr_lock); } static inline int mrtryupdate(mrlock_t *mrp) { - if (!down_write_trylock(&mrp->mr_lock)) + if (!anon_down_write_trylock(&mrp->mr_lock)) return 0; #ifdef DEBUG mrp->mr_writer = 1; @@ -71,12 +71,12 @@ static inline void mrunlock_excl(mrlock_t *mrp) #ifdef DEBUG mrp->mr_writer = 0; #endif - up_write(&mrp->mr_lock); + anon_up_write(&mrp->mr_lock); } static inline void mrunlock_shared(mrlock_t *mrp) { - up_read(&mrp->mr_lock); + anon_up_read(&mrp->mr_lock); } static inline void mrdemote(mrlock_t *mrp) @@ -84,7 +84,7 @@ static inline void mrdemote(mrlock_t *mrp) #ifdef DEBUG mrp->mr_writer = 0; #endif - downgrade_write(&mrp->mr_lock); + anon_downgrade_write(&mrp->mr_lock); } #endif /* __XFS_SUPPORT_MRLOCK_H__ */ diff --git a/fs/xfs/linux-2.6/xfs_export.c b/fs/xfs/linux-2.6/xfs_export.c index fed3f3c878c6..0470488aac38 100644 --- a/fs/xfs/linux-2.6/xfs_export.c +++ b/fs/xfs/linux-2.6/xfs_export.c @@ -97,20 +97,20 @@ xfs_fs_encode_fh( switch (fileid_type) { case FILEID_INO32_GEN_PARENT: - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); fid->i32.parent_ino = XFS_I(dentry->d_parent->d_inode)->i_ino; fid->i32.parent_gen = dentry->d_parent->d_inode->i_generation; - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); /*FALLTHRU*/ case FILEID_INO32_GEN: fid->i32.ino = XFS_I(inode)->i_ino; fid->i32.gen = inode->i_generation; break; case FILEID_INO32_GEN_PARENT | XFS_FILEID_TYPE_64FLAG: - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); fid64->parent_ino = XFS_I(dentry->d_parent->d_inode)->i_ino; fid64->parent_gen = dentry->d_parent->d_inode->i_generation; - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); /*FALLTHRU*/ case FILEID_INO32_GEN | XFS_FILEID_TYPE_64FLAG: fid64->ino = XFS_I(inode)->i_ino; diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c index e6ac98c112e3..523c451f0465 100644 --- a/fs/xfs/linux-2.6/xfs_super.c +++ b/fs/xfs/linux-2.6/xfs_super.c @@ -966,7 +966,7 @@ xfs_fs_evict_inode( * (and basically indicate what we are doing), we explicitly * re-init the iolock here. */ - ASSERT(!rwsem_is_locked(&ip->i_iolock.mr_lock)); + ASSERT(!anon_rwsem_is_locked(&ip->i_iolock.mr_lock)); mrlock_init(&ip->i_iolock, MRLOCK_BARRIER, "xfsio", ip->i_ino); lockdep_set_class_and_name(&ip->i_iolock.mr_lock, &xfs_iolock_reclaimable, "xfs_iolock_reclaimable"); diff --git a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c index ca752f05c31c..8ac164bb0a26 100644 --- a/fs/xfs/xfs_iget.c +++ b/fs/xfs/xfs_iget.c @@ -272,7 +272,7 @@ xfs_iget_cache_hit( __xfs_inode_clear_reclaim_tag(mp, pag, ip); inode->i_state = I_NEW; - ASSERT(!rwsem_is_locked(&ip->i_iolock.mr_lock)); + ASSERT(!anon_rwsem_is_locked(&ip->i_iolock.mr_lock)); mrlock_init(&ip->i_iolock, MRLOCK_BARRIER, "xfsio", ip->i_ino); lockdep_set_class_and_name(&ip->i_iolock.mr_lock, &xfs_iolock_active, "xfs_iolock_active"); @@ -712,13 +712,13 @@ xfs_isilocked( if (lock_flags & (XFS_ILOCK_EXCL|XFS_ILOCK_SHARED)) { if (!(lock_flags & XFS_ILOCK_SHARED)) return !!ip->i_lock.mr_writer; - return rwsem_is_locked(&ip->i_lock.mr_lock); + return anon_rwsem_is_locked(&ip->i_lock.mr_lock); } if (lock_flags & (XFS_IOLOCK_EXCL|XFS_IOLOCK_SHARED)) { if (!(lock_flags & XFS_IOLOCK_SHARED)) return !!ip->i_iolock.mr_writer; - return rwsem_is_locked(&ip->i_iolock.mr_lock); + return anon_rwsem_is_locked(&ip->i_iolock.mr_lock); } ASSERT(0); |