aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2
diff options
context:
space:
mode:
Diffstat (limited to 'fs/gfs2')
-rw-r--r--fs/gfs2/bmap.c2
-rw-r--r--fs/gfs2/dir.c2
-rw-r--r--fs/gfs2/glock.c37
-rw-r--r--fs/gfs2/glock.h4
-rw-r--r--fs/gfs2/incore.h4
-rw-r--r--fs/gfs2/inode.c2
-rw-r--r--fs/gfs2/ops_address.c2
-rw-r--r--fs/gfs2/ops_export.c2
-rw-r--r--fs/gfs2/ops_fstype.c7
-rw-r--r--fs/gfs2/ops_inode.c2
10 files changed, 38 insertions, 26 deletions
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index e4effc47abfc..e9456ebd3bb6 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -932,7 +932,7 @@ static int gfs2_block_truncate_page(struct address_space *mapping)
932 if (!gfs2_is_writeback(ip)) 932 if (!gfs2_is_writeback(ip))
933 gfs2_trans_add_bh(ip->i_gl, bh, 0); 933 gfs2_trans_add_bh(ip->i_gl, bh, 0);
934 934
935 zero_user_page(page, offset, length, KM_USER0); 935 zero_user(page, offset, length);
936 936
937unlock: 937unlock:
938 unlock_page(page); 938 unlock_page(page);
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index 57e2ed932adc..c34709512b19 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -1498,7 +1498,7 @@ struct inode *gfs2_dir_search(struct inode *dir, const struct qstr *name)
1498 dent = gfs2_dirent_search(dir, name, gfs2_dirent_find, &bh); 1498 dent = gfs2_dirent_search(dir, name, gfs2_dirent_find, &bh);
1499 if (dent) { 1499 if (dent) {
1500 if (IS_ERR(dent)) 1500 if (IS_ERR(dent))
1501 return ERR_PTR(PTR_ERR(dent)); 1501 return ERR_CAST(dent);
1502 inode = gfs2_inode_lookup(dir->i_sb, 1502 inode = gfs2_inode_lookup(dir->i_sb,
1503 be16_to_cpu(dent->de_type), 1503 be16_to_cpu(dent->de_type),
1504 be64_to_cpu(dent->de_inum.no_addr), 1504 be64_to_cpu(dent->de_inum.no_addr),
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index 80e09c50590a..7175a4d06435 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -334,7 +334,7 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number,
334 gl->gl_state = LM_ST_UNLOCKED; 334 gl->gl_state = LM_ST_UNLOCKED;
335 gl->gl_demote_state = LM_ST_EXCLUSIVE; 335 gl->gl_demote_state = LM_ST_EXCLUSIVE;
336 gl->gl_hash = hash; 336 gl->gl_hash = hash;
337 gl->gl_owner_pid = 0; 337 gl->gl_owner_pid = NULL;
338 gl->gl_ip = 0; 338 gl->gl_ip = 0;
339 gl->gl_ops = glops; 339 gl->gl_ops = glops;
340 gl->gl_req_gh = NULL; 340 gl->gl_req_gh = NULL;
@@ -399,7 +399,7 @@ void gfs2_holder_init(struct gfs2_glock *gl, unsigned int state, unsigned flags,
399 INIT_LIST_HEAD(&gh->gh_list); 399 INIT_LIST_HEAD(&gh->gh_list);
400 gh->gh_gl = gl; 400 gh->gh_gl = gl;
401 gh->gh_ip = (unsigned long)__builtin_return_address(0); 401 gh->gh_ip = (unsigned long)__builtin_return_address(0);
402 gh->gh_owner_pid = current->pid; 402 gh->gh_owner_pid = get_pid(task_pid(current));
403 gh->gh_state = state; 403 gh->gh_state = state;
404 gh->gh_flags = flags; 404 gh->gh_flags = flags;
405 gh->gh_error = 0; 405 gh->gh_error = 0;
@@ -433,6 +433,7 @@ void gfs2_holder_reinit(unsigned int state, unsigned flags, struct gfs2_holder *
433 433
434void gfs2_holder_uninit(struct gfs2_holder *gh) 434void gfs2_holder_uninit(struct gfs2_holder *gh)
435{ 435{
436 put_pid(gh->gh_owner_pid);
436 gfs2_glock_put(gh->gh_gl); 437 gfs2_glock_put(gh->gh_gl);
437 gh->gh_gl = NULL; 438 gh->gh_gl = NULL;
438 gh->gh_ip = 0; 439 gh->gh_ip = 0;
@@ -631,7 +632,7 @@ static void gfs2_glmutex_lock(struct gfs2_glock *gl)
631 wait_on_holder(&gh); 632 wait_on_holder(&gh);
632 gfs2_holder_uninit(&gh); 633 gfs2_holder_uninit(&gh);
633 } else { 634 } else {
634 gl->gl_owner_pid = current->pid; 635 gl->gl_owner_pid = get_pid(task_pid(current));
635 gl->gl_ip = (unsigned long)__builtin_return_address(0); 636 gl->gl_ip = (unsigned long)__builtin_return_address(0);
636 spin_unlock(&gl->gl_spin); 637 spin_unlock(&gl->gl_spin);
637 } 638 }
@@ -652,7 +653,7 @@ static int gfs2_glmutex_trylock(struct gfs2_glock *gl)
652 if (test_and_set_bit(GLF_LOCK, &gl->gl_flags)) { 653 if (test_and_set_bit(GLF_LOCK, &gl->gl_flags)) {
653 acquired = 0; 654 acquired = 0;
654 } else { 655 } else {
655 gl->gl_owner_pid = current->pid; 656 gl->gl_owner_pid = get_pid(task_pid(current));
656 gl->gl_ip = (unsigned long)__builtin_return_address(0); 657 gl->gl_ip = (unsigned long)__builtin_return_address(0);
657 } 658 }
658 spin_unlock(&gl->gl_spin); 659 spin_unlock(&gl->gl_spin);
@@ -668,12 +669,17 @@ static int gfs2_glmutex_trylock(struct gfs2_glock *gl)
668 669
669static void gfs2_glmutex_unlock(struct gfs2_glock *gl) 670static void gfs2_glmutex_unlock(struct gfs2_glock *gl)
670{ 671{
672 struct pid *pid;
673
671 spin_lock(&gl->gl_spin); 674 spin_lock(&gl->gl_spin);
672 clear_bit(GLF_LOCK, &gl->gl_flags); 675 clear_bit(GLF_LOCK, &gl->gl_flags);
673 gl->gl_owner_pid = 0; 676 pid = gl->gl_owner_pid;
677 gl->gl_owner_pid = NULL;
674 gl->gl_ip = 0; 678 gl->gl_ip = 0;
675 run_queue(gl); 679 run_queue(gl);
676 spin_unlock(&gl->gl_spin); 680 spin_unlock(&gl->gl_spin);
681
682 put_pid(pid);
677} 683}
678 684
679/** 685/**
@@ -1045,7 +1051,7 @@ static int glock_wait_internal(struct gfs2_holder *gh)
1045} 1051}
1046 1052
1047static inline struct gfs2_holder * 1053static inline struct gfs2_holder *
1048find_holder_by_owner(struct list_head *head, pid_t pid) 1054find_holder_by_owner(struct list_head *head, struct pid *pid)
1049{ 1055{
1050 struct gfs2_holder *gh; 1056 struct gfs2_holder *gh;
1051 1057
@@ -1082,7 +1088,7 @@ static void add_to_queue(struct gfs2_holder *gh)
1082 struct gfs2_glock *gl = gh->gh_gl; 1088 struct gfs2_glock *gl = gh->gh_gl;
1083 struct gfs2_holder *existing; 1089 struct gfs2_holder *existing;
1084 1090
1085 BUG_ON(!gh->gh_owner_pid); 1091 BUG_ON(gh->gh_owner_pid == NULL);
1086 if (test_and_set_bit(HIF_WAIT, &gh->gh_iflags)) 1092 if (test_and_set_bit(HIF_WAIT, &gh->gh_iflags))
1087 BUG(); 1093 BUG();
1088 1094
@@ -1092,12 +1098,14 @@ static void add_to_queue(struct gfs2_holder *gh)
1092 if (existing) { 1098 if (existing) {
1093 print_symbol(KERN_WARNING "original: %s\n", 1099 print_symbol(KERN_WARNING "original: %s\n",
1094 existing->gh_ip); 1100 existing->gh_ip);
1095 printk(KERN_INFO "pid : %d\n", existing->gh_owner_pid); 1101 printk(KERN_INFO "pid : %d\n",
1102 pid_nr(existing->gh_owner_pid));
1096 printk(KERN_INFO "lock type : %d lock state : %d\n", 1103 printk(KERN_INFO "lock type : %d lock state : %d\n",
1097 existing->gh_gl->gl_name.ln_type, 1104 existing->gh_gl->gl_name.ln_type,
1098 existing->gh_gl->gl_state); 1105 existing->gh_gl->gl_state);
1099 print_symbol(KERN_WARNING "new: %s\n", gh->gh_ip); 1106 print_symbol(KERN_WARNING "new: %s\n", gh->gh_ip);
1100 printk(KERN_INFO "pid : %d\n", gh->gh_owner_pid); 1107 printk(KERN_INFO "pid : %d\n",
1108 pid_nr(gh->gh_owner_pid));
1101 printk(KERN_INFO "lock type : %d lock state : %d\n", 1109 printk(KERN_INFO "lock type : %d lock state : %d\n",
1102 gl->gl_name.ln_type, gl->gl_state); 1110 gl->gl_name.ln_type, gl->gl_state);
1103 BUG(); 1111 BUG();
@@ -1798,8 +1806,9 @@ static int dump_holder(struct glock_iter *gi, char *str,
1798 1806
1799 print_dbg(gi, " %s\n", str); 1807 print_dbg(gi, " %s\n", str);
1800 if (gh->gh_owner_pid) { 1808 if (gh->gh_owner_pid) {
1801 print_dbg(gi, " owner = %ld ", (long)gh->gh_owner_pid); 1809 print_dbg(gi, " owner = %ld ",
1802 gh_owner = find_task_by_pid(gh->gh_owner_pid); 1810 (long)pid_nr(gh->gh_owner_pid));
1811 gh_owner = pid_task(gh->gh_owner_pid, PIDTYPE_PID);
1803 if (gh_owner) 1812 if (gh_owner)
1804 print_dbg(gi, "(%s)\n", gh_owner->comm); 1813 print_dbg(gi, "(%s)\n", gh_owner->comm);
1805 else 1814 else
@@ -1877,13 +1886,13 @@ static int dump_glock(struct glock_iter *gi, struct gfs2_glock *gl)
1877 print_dbg(gi, " gl_ref = %d\n", atomic_read(&gl->gl_ref)); 1886 print_dbg(gi, " gl_ref = %d\n", atomic_read(&gl->gl_ref));
1878 print_dbg(gi, " gl_state = %u\n", gl->gl_state); 1887 print_dbg(gi, " gl_state = %u\n", gl->gl_state);
1879 if (gl->gl_owner_pid) { 1888 if (gl->gl_owner_pid) {
1880 gl_owner = find_task_by_pid(gl->gl_owner_pid); 1889 gl_owner = pid_task(gl->gl_owner_pid, PIDTYPE_PID);
1881 if (gl_owner) 1890 if (gl_owner)
1882 print_dbg(gi, " gl_owner = pid %d (%s)\n", 1891 print_dbg(gi, " gl_owner = pid %d (%s)\n",
1883 gl->gl_owner_pid, gl_owner->comm); 1892 pid_nr(gl->gl_owner_pid), gl_owner->comm);
1884 else 1893 else
1885 print_dbg(gi, " gl_owner = %d (ended)\n", 1894 print_dbg(gi, " gl_owner = %d (ended)\n",
1886 gl->gl_owner_pid); 1895 pid_nr(gl->gl_owner_pid));
1887 } else 1896 } else
1888 print_dbg(gi, " gl_owner = -1\n"); 1897 print_dbg(gi, " gl_owner = -1\n");
1889 print_dbg(gi, " gl_ip = %lu\n", gl->gl_ip); 1898 print_dbg(gi, " gl_ip = %lu\n", gl->gl_ip);
diff --git a/fs/gfs2/glock.h b/fs/gfs2/glock.h
index b16f604eea9f..2f9c6d136b37 100644
--- a/fs/gfs2/glock.h
+++ b/fs/gfs2/glock.h
@@ -36,11 +36,13 @@ static inline int gfs2_glock_is_locked_by_me(struct gfs2_glock *gl)
36{ 36{
37 struct gfs2_holder *gh; 37 struct gfs2_holder *gh;
38 int locked = 0; 38 int locked = 0;
39 struct pid *pid;
39 40
40 /* Look in glock's list of holders for one with current task as owner */ 41 /* Look in glock's list of holders for one with current task as owner */
41 spin_lock(&gl->gl_spin); 42 spin_lock(&gl->gl_spin);
43 pid = task_pid(current);
42 list_for_each_entry(gh, &gl->gl_holders, gh_list) { 44 list_for_each_entry(gh, &gl->gl_holders, gh_list) {
43 if (gh->gh_owner_pid == current->pid) { 45 if (gh->gh_owner_pid == pid) {
44 locked = 1; 46 locked = 1;
45 break; 47 break;
46 } 48 }
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
index 513aaf0dc0ab..525dcae352d6 100644
--- a/fs/gfs2/incore.h
+++ b/fs/gfs2/incore.h
@@ -151,7 +151,7 @@ struct gfs2_holder {
151 struct list_head gh_list; 151 struct list_head gh_list;
152 152
153 struct gfs2_glock *gh_gl; 153 struct gfs2_glock *gh_gl;
154 pid_t gh_owner_pid; 154 struct pid *gh_owner_pid;
155 unsigned int gh_state; 155 unsigned int gh_state;
156 unsigned gh_flags; 156 unsigned gh_flags;
157 157
@@ -182,7 +182,7 @@ struct gfs2_glock {
182 unsigned int gl_hash; 182 unsigned int gl_hash;
183 unsigned int gl_demote_state; /* state requested by remote node */ 183 unsigned int gl_demote_state; /* state requested by remote node */
184 unsigned long gl_demote_time; /* time of first demote request */ 184 unsigned long gl_demote_time; /* time of first demote request */
185 pid_t gl_owner_pid; 185 struct pid *gl_owner_pid;
186 unsigned long gl_ip; 186 unsigned long gl_ip;
187 struct list_head gl_holders; 187 struct list_head gl_holders;
188 struct list_head gl_waiters1; /* HIF_MUTEX */ 188 struct list_head gl_waiters1; /* HIF_MUTEX */
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 728d3169e7bd..37725ade3c51 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -240,7 +240,7 @@ fail_put:
240 ip->i_gl->gl_object = NULL; 240 ip->i_gl->gl_object = NULL;
241 gfs2_glock_put(ip->i_gl); 241 gfs2_glock_put(ip->i_gl);
242fail: 242fail:
243 iput(inode); 243 iget_failed(inode);
244 return ERR_PTR(error); 244 return ERR_PTR(error);
245} 245}
246 246
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c
index 38dbe99a30ed..ac772b6d9dbb 100644
--- a/fs/gfs2/ops_address.c
+++ b/fs/gfs2/ops_address.c
@@ -446,7 +446,7 @@ static int stuffed_readpage(struct gfs2_inode *ip, struct page *page)
446 * so we need to supply one here. It doesn't happen often. 446 * so we need to supply one here. It doesn't happen often.
447 */ 447 */
448 if (unlikely(page->index)) { 448 if (unlikely(page->index)) {
449 zero_user_page(page, 0, PAGE_CACHE_SIZE, KM_USER0); 449 zero_user(page, 0, PAGE_CACHE_SIZE);
450 return 0; 450 return 0;
451 } 451 }
452 452
diff --git a/fs/gfs2/ops_export.c b/fs/gfs2/ops_export.c
index b9da62348a87..334c7f85351b 100644
--- a/fs/gfs2/ops_export.c
+++ b/fs/gfs2/ops_export.c
@@ -143,7 +143,7 @@ static struct dentry *gfs2_get_parent(struct dentry *child)
143 * have to return that as a(n invalid) pointer to dentry. 143 * have to return that as a(n invalid) pointer to dentry.
144 */ 144 */
145 if (IS_ERR(inode)) 145 if (IS_ERR(inode))
146 return ERR_PTR(PTR_ERR(inode)); 146 return ERR_CAST(inode);
147 147
148 dentry = d_alloc_anon(inode); 148 dentry = d_alloc_anon(inode);
149 if (!dentry) { 149 if (!dentry) {
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index 43d511bba52d..4bee6aa845e4 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -884,12 +884,13 @@ static struct super_block* get_gfs2_sb(const char *dev_name)
884 dev_name); 884 dev_name);
885 goto out; 885 goto out;
886 } 886 }
887 error = vfs_getattr(nd.mnt, nd.dentry, &stat); 887 error = vfs_getattr(nd.path.mnt, nd.path.dentry, &stat);
888 888
889 fstype = get_fs_type("gfs2"); 889 fstype = get_fs_type("gfs2");
890 list_for_each_entry(s, &fstype->fs_supers, s_instances) { 890 list_for_each_entry(s, &fstype->fs_supers, s_instances) {
891 if ((S_ISBLK(stat.mode) && s->s_dev == stat.rdev) || 891 if ((S_ISBLK(stat.mode) && s->s_dev == stat.rdev) ||
892 (S_ISDIR(stat.mode) && s == nd.dentry->d_inode->i_sb)) { 892 (S_ISDIR(stat.mode) &&
893 s == nd.path.dentry->d_inode->i_sb)) {
893 sb = s; 894 sb = s;
894 goto free_nd; 895 goto free_nd;
895 } 896 }
@@ -899,7 +900,7 @@ static struct super_block* get_gfs2_sb(const char *dev_name)
899 "mount point %s\n", dev_name); 900 "mount point %s\n", dev_name);
900 901
901free_nd: 902free_nd:
902 path_release(&nd); 903 path_put(&nd.path);
903out: 904out:
904 return sb; 905 return sb;
905} 906}
diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c
index 9f71372c1757..e87412902bed 100644
--- a/fs/gfs2/ops_inode.c
+++ b/fs/gfs2/ops_inode.c
@@ -111,7 +111,7 @@ static struct dentry *gfs2_lookup(struct inode *dir, struct dentry *dentry,
111 111
112 inode = gfs2_lookupi(dir, &dentry->d_name, 0, nd); 112 inode = gfs2_lookupi(dir, &dentry->d_name, 0, nd);
113 if (inode && IS_ERR(inode)) 113 if (inode && IS_ERR(inode))
114 return ERR_PTR(PTR_ERR(inode)); 114 return ERR_CAST(inode);
115 115
116 if (inode) { 116 if (inode) {
117 struct gfs2_glock *gl = GFS2_I(inode)->i_gl; 117 struct gfs2_glock *gl = GFS2_I(inode)->i_gl;