diff options
Diffstat (limited to 'fs')
54 files changed, 531 insertions, 383 deletions
diff --git a/fs/Kconfig b/fs/Kconfig index e31f3691b1..cc28a69246 100644 --- a/fs/Kconfig +++ b/fs/Kconfig | |||
@@ -220,7 +220,7 @@ config JBD | |||
220 | 220 | ||
221 | config JBD_DEBUG | 221 | config JBD_DEBUG |
222 | bool "JBD (ext3) debugging support" | 222 | bool "JBD (ext3) debugging support" |
223 | depends on JBD | 223 | depends on JBD && DEBUG_FS |
224 | help | 224 | help |
225 | If you are using the ext3 journaled file system (or potentially any | 225 | If you are using the ext3 journaled file system (or potentially any |
226 | other file system/device using JBD), this option allows you to | 226 | other file system/device using JBD), this option allows you to |
@@ -229,10 +229,10 @@ config JBD_DEBUG | |||
229 | debugging output will be turned off. | 229 | debugging output will be turned off. |
230 | 230 | ||
231 | If you select Y here, then you will be able to turn on debugging | 231 | If you select Y here, then you will be able to turn on debugging |
232 | with "echo N > /proc/sys/fs/jbd-debug", where N is a number between | 232 | with "echo N > /sys/kernel/debug/jbd/jbd-debug", where N is a |
233 | 1 and 5, the higher the number, the more debugging output is | 233 | number between 1 and 5, the higher the number, the more debugging |
234 | generated. To turn debugging off again, do | 234 | output is generated. To turn debugging off again, do |
235 | "echo 0 > /proc/sys/fs/jbd-debug". | 235 | "echo 0 > /sys/kernel/debug/jbd/jbd-debug". |
236 | 236 | ||
237 | config JBD2 | 237 | config JBD2 |
238 | tristate | 238 | tristate |
diff --git a/fs/autofs/inode.c b/fs/autofs/inode.c index e7204d71ac..45f5992a09 100644 --- a/fs/autofs/inode.c +++ b/fs/autofs/inode.c | |||
@@ -80,7 +80,7 @@ static int parse_options(char *options, int *pipefd, uid_t *uid, gid_t *gid, | |||
80 | 80 | ||
81 | *uid = current->uid; | 81 | *uid = current->uid; |
82 | *gid = current->gid; | 82 | *gid = current->gid; |
83 | *pgrp = process_group(current); | 83 | *pgrp = task_pgrp_nr(current); |
84 | 84 | ||
85 | *minproto = *maxproto = AUTOFS_PROTO_VERSION; | 85 | *minproto = *maxproto = AUTOFS_PROTO_VERSION; |
86 | 86 | ||
diff --git a/fs/autofs/root.c b/fs/autofs/root.c index c148953327..5efff3c0d8 100644 --- a/fs/autofs/root.c +++ b/fs/autofs/root.c | |||
@@ -214,8 +214,8 @@ static struct dentry *autofs_root_lookup(struct inode *dir, struct dentry *dentr | |||
214 | 214 | ||
215 | oz_mode = autofs_oz_mode(sbi); | 215 | oz_mode = autofs_oz_mode(sbi); |
216 | DPRINTK(("autofs_lookup: pid = %u, pgrp = %u, catatonic = %d, " | 216 | DPRINTK(("autofs_lookup: pid = %u, pgrp = %u, catatonic = %d, " |
217 | "oz_mode = %d\n", pid_nr(task_pid(current)), | 217 | "oz_mode = %d\n", task_pid_nr(current), |
218 | process_group(current), sbi->catatonic, | 218 | task_pgrp_nr(current), sbi->catatonic, |
219 | oz_mode)); | 219 | oz_mode)); |
220 | 220 | ||
221 | /* | 221 | /* |
@@ -536,7 +536,7 @@ static int autofs_root_ioctl(struct inode *inode, struct file *filp, | |||
536 | struct autofs_sb_info *sbi = autofs_sbi(inode->i_sb); | 536 | struct autofs_sb_info *sbi = autofs_sbi(inode->i_sb); |
537 | void __user *argp = (void __user *)arg; | 537 | void __user *argp = (void __user *)arg; |
538 | 538 | ||
539 | DPRINTK(("autofs_ioctl: cmd = 0x%08x, arg = 0x%08lx, sbi = %p, pgrp = %u\n",cmd,arg,sbi,process_group(current))); | 539 | DPRINTK(("autofs_ioctl: cmd = 0x%08x, arg = 0x%08lx, sbi = %p, pgrp = %u\n",cmd,arg,sbi,task_pgrp_nr(current))); |
540 | 540 | ||
541 | if (_IOC_TYPE(cmd) != _IOC_TYPE(AUTOFS_IOC_FIRST) || | 541 | if (_IOC_TYPE(cmd) != _IOC_TYPE(AUTOFS_IOC_FIRST) || |
542 | _IOC_NR(cmd) - _IOC_NR(AUTOFS_IOC_FIRST) >= AUTOFS_IOC_COUNT) | 542 | _IOC_NR(cmd) - _IOC_NR(AUTOFS_IOC_FIRST) >= AUTOFS_IOC_COUNT) |
diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h index d85f42fa92..2d4ae40718 100644 --- a/fs/autofs4/autofs_i.h +++ b/fs/autofs4/autofs_i.h | |||
@@ -131,7 +131,7 @@ static inline struct autofs_info *autofs4_dentry_ino(struct dentry *dentry) | |||
131 | filesystem without "magic".) */ | 131 | filesystem without "magic".) */ |
132 | 132 | ||
133 | static inline int autofs4_oz_mode(struct autofs_sb_info *sbi) { | 133 | static inline int autofs4_oz_mode(struct autofs_sb_info *sbi) { |
134 | return sbi->catatonic || process_group(current) == sbi->oz_pgrp; | 134 | return sbi->catatonic || task_pgrp_nr(current) == sbi->oz_pgrp; |
135 | } | 135 | } |
136 | 136 | ||
137 | /* Does a dentry have some pending activity? */ | 137 | /* Does a dentry have some pending activity? */ |
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c index cd81f08366..7f05d6ccdb 100644 --- a/fs/autofs4/inode.c +++ b/fs/autofs4/inode.c | |||
@@ -226,7 +226,7 @@ static int parse_options(char *options, int *pipefd, uid_t *uid, gid_t *gid, | |||
226 | 226 | ||
227 | *uid = current->uid; | 227 | *uid = current->uid; |
228 | *gid = current->gid; | 228 | *gid = current->gid; |
229 | *pgrp = process_group(current); | 229 | *pgrp = task_pgrp_nr(current); |
230 | 230 | ||
231 | *minproto = AUTOFS_MIN_PROTO_VERSION; | 231 | *minproto = AUTOFS_MIN_PROTO_VERSION; |
232 | *maxproto = AUTOFS_MAX_PROTO_VERSION; | 232 | *maxproto = AUTOFS_MAX_PROTO_VERSION; |
@@ -323,7 +323,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent) | |||
323 | sbi->pipe = NULL; | 323 | sbi->pipe = NULL; |
324 | sbi->catatonic = 1; | 324 | sbi->catatonic = 1; |
325 | sbi->exp_timeout = 0; | 325 | sbi->exp_timeout = 0; |
326 | sbi->oz_pgrp = process_group(current); | 326 | sbi->oz_pgrp = task_pgrp_nr(current); |
327 | sbi->sb = s; | 327 | sbi->sb = s; |
328 | sbi->version = 0; | 328 | sbi->version = 0; |
329 | sbi->sub_version = 0; | 329 | sbi->sub_version = 0; |
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c index 45ff3d63b7..2bbcc8151d 100644 --- a/fs/autofs4/root.c +++ b/fs/autofs4/root.c | |||
@@ -582,7 +582,7 @@ static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, s | |||
582 | oz_mode = autofs4_oz_mode(sbi); | 582 | oz_mode = autofs4_oz_mode(sbi); |
583 | 583 | ||
584 | DPRINTK("pid = %u, pgrp = %u, catatonic = %d, oz_mode = %d", | 584 | DPRINTK("pid = %u, pgrp = %u, catatonic = %d, oz_mode = %d", |
585 | current->pid, process_group(current), sbi->catatonic, oz_mode); | 585 | current->pid, task_pgrp_nr(current), sbi->catatonic, oz_mode); |
586 | 586 | ||
587 | unhashed = autofs4_lookup_unhashed(sbi, dentry->d_parent, &dentry->d_name); | 587 | unhashed = autofs4_lookup_unhashed(sbi, dentry->d_parent, &dentry->d_name); |
588 | if (!unhashed) { | 588 | if (!unhashed) { |
@@ -976,7 +976,7 @@ static int autofs4_root_ioctl(struct inode *inode, struct file *filp, | |||
976 | void __user *p = (void __user *)arg; | 976 | void __user *p = (void __user *)arg; |
977 | 977 | ||
978 | DPRINTK("cmd = 0x%08x, arg = 0x%08lx, sbi = %p, pgrp = %u", | 978 | DPRINTK("cmd = 0x%08x, arg = 0x%08lx, sbi = %p, pgrp = %u", |
979 | cmd,arg,sbi,process_group(current)); | 979 | cmd,arg,sbi,task_pgrp_nr(current)); |
980 | 980 | ||
981 | if (_IOC_TYPE(cmd) != _IOC_TYPE(AUTOFS_IOC_FIRST) || | 981 | if (_IOC_TYPE(cmd) != _IOC_TYPE(AUTOFS_IOC_FIRST) || |
982 | _IOC_NR(cmd) - _IOC_NR(AUTOFS_IOC_FIRST) >= AUTOFS_IOC_COUNT) | 982 | _IOC_NR(cmd) - _IOC_NR(AUTOFS_IOC_FIRST) >= AUTOFS_IOC_COUNT) |
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 6e2f3b8dde..ba8de7ca26 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
@@ -1383,10 +1383,10 @@ static void fill_prstatus(struct elf_prstatus *prstatus, | |||
1383 | prstatus->pr_info.si_signo = prstatus->pr_cursig = signr; | 1383 | prstatus->pr_info.si_signo = prstatus->pr_cursig = signr; |
1384 | prstatus->pr_sigpend = p->pending.signal.sig[0]; | 1384 | prstatus->pr_sigpend = p->pending.signal.sig[0]; |
1385 | prstatus->pr_sighold = p->blocked.sig[0]; | 1385 | prstatus->pr_sighold = p->blocked.sig[0]; |
1386 | prstatus->pr_pid = p->pid; | 1386 | prstatus->pr_pid = task_pid_vnr(p); |
1387 | prstatus->pr_ppid = p->parent->pid; | 1387 | prstatus->pr_ppid = task_pid_vnr(p->parent); |
1388 | prstatus->pr_pgrp = process_group(p); | 1388 | prstatus->pr_pgrp = task_pgrp_vnr(p); |
1389 | prstatus->pr_sid = process_session(p); | 1389 | prstatus->pr_sid = task_session_vnr(p); |
1390 | if (thread_group_leader(p)) { | 1390 | if (thread_group_leader(p)) { |
1391 | /* | 1391 | /* |
1392 | * This is the record for the group leader. Add in the | 1392 | * This is the record for the group leader. Add in the |
@@ -1429,10 +1429,10 @@ static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p, | |||
1429 | psinfo->pr_psargs[i] = ' '; | 1429 | psinfo->pr_psargs[i] = ' '; |
1430 | psinfo->pr_psargs[len] = 0; | 1430 | psinfo->pr_psargs[len] = 0; |
1431 | 1431 | ||
1432 | psinfo->pr_pid = p->pid; | 1432 | psinfo->pr_pid = task_pid_vnr(p); |
1433 | psinfo->pr_ppid = p->parent->pid; | 1433 | psinfo->pr_ppid = task_pid_vnr(p->parent); |
1434 | psinfo->pr_pgrp = process_group(p); | 1434 | psinfo->pr_pgrp = task_pgrp_vnr(p); |
1435 | psinfo->pr_sid = process_session(p); | 1435 | psinfo->pr_sid = task_session_vnr(p); |
1436 | 1436 | ||
1437 | i = p->state ? ffz(~p->state) + 1 : 0; | 1437 | i = p->state ? ffz(~p->state) + 1 : 0; |
1438 | psinfo->pr_state = i; | 1438 | psinfo->pr_state = i; |
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c index 033861c6b8..32649f2a16 100644 --- a/fs/binfmt_elf_fdpic.c +++ b/fs/binfmt_elf_fdpic.c | |||
@@ -1342,10 +1342,10 @@ static void fill_prstatus(struct elf_prstatus *prstatus, | |||
1342 | prstatus->pr_info.si_signo = prstatus->pr_cursig = signr; | 1342 | prstatus->pr_info.si_signo = prstatus->pr_cursig = signr; |
1343 | prstatus->pr_sigpend = p->pending.signal.sig[0]; | 1343 | prstatus->pr_sigpend = p->pending.signal.sig[0]; |
1344 | prstatus->pr_sighold = p->blocked.sig[0]; | 1344 | prstatus->pr_sighold = p->blocked.sig[0]; |
1345 | prstatus->pr_pid = p->pid; | 1345 | prstatus->pr_pid = task_pid_vnr(p); |
1346 | prstatus->pr_ppid = p->parent->pid; | 1346 | prstatus->pr_ppid = task_pid_vnr(p->parent); |
1347 | prstatus->pr_pgrp = process_group(p); | 1347 | prstatus->pr_pgrp = task_pgrp_vnr(p); |
1348 | prstatus->pr_sid = process_session(p); | 1348 | prstatus->pr_sid = task_session_vnr(p); |
1349 | if (thread_group_leader(p)) { | 1349 | if (thread_group_leader(p)) { |
1350 | /* | 1350 | /* |
1351 | * This is the record for the group leader. Add in the | 1351 | * This is the record for the group leader. Add in the |
@@ -1391,10 +1391,10 @@ static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p, | |||
1391 | psinfo->pr_psargs[i] = ' '; | 1391 | psinfo->pr_psargs[i] = ' '; |
1392 | psinfo->pr_psargs[len] = 0; | 1392 | psinfo->pr_psargs[len] = 0; |
1393 | 1393 | ||
1394 | psinfo->pr_pid = p->pid; | 1394 | psinfo->pr_pid = task_pid_vnr(p); |
1395 | psinfo->pr_ppid = p->parent->pid; | 1395 | psinfo->pr_ppid = task_pid_vnr(p->parent); |
1396 | psinfo->pr_pgrp = process_group(p); | 1396 | psinfo->pr_pgrp = task_pgrp_vnr(p); |
1397 | psinfo->pr_sid = process_session(p); | 1397 | psinfo->pr_sid = task_session_vnr(p); |
1398 | 1398 | ||
1399 | i = p->state ? ffz(~p->state) + 1 : 0; | 1399 | i = p->state ? ffz(~p->state) + 1 : 0; |
1400 | psinfo->pr_state = i; | 1400 | psinfo->pr_state = i; |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 4af3588c1a..370866cb3d 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -352,7 +352,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) | |||
352 | 352 | ||
353 | current->flags |= PF_MEMALLOC; | 353 | current->flags |= PF_MEMALLOC; |
354 | server->tsk = current; /* save process info to wake at shutdown */ | 354 | server->tsk = current; /* save process info to wake at shutdown */ |
355 | cFYI(1, ("Demultiplex PID: %d", current->pid)); | 355 | cFYI(1, ("Demultiplex PID: %d", task_pid_nr(current))); |
356 | write_lock(&GlobalSMBSeslock); | 356 | write_lock(&GlobalSMBSeslock); |
357 | atomic_inc(&tcpSesAllocCount); | 357 | atomic_inc(&tcpSesAllocCount); |
358 | length = tcpSesAllocCount.counter; | 358 | length = tcpSesAllocCount.counter; |
diff --git a/fs/coda/upcall.c b/fs/coda/upcall.c index cdb4c07a78..359e531094 100644 --- a/fs/coda/upcall.c +++ b/fs/coda/upcall.c | |||
@@ -51,7 +51,7 @@ static void *alloc_upcall(int opcode, int size) | |||
51 | 51 | ||
52 | inp->ih.opcode = opcode; | 52 | inp->ih.opcode = opcode; |
53 | inp->ih.pid = current->pid; | 53 | inp->ih.pid = current->pid; |
54 | inp->ih.pgid = process_group(current); | 54 | inp->ih.pgid = task_pgrp_nr(current); |
55 | #ifdef CONFIG_CODA_FS_OLD_API | 55 | #ifdef CONFIG_CODA_FS_OLD_API |
56 | memset(&inp->ih.cred, 0, sizeof(struct coda_cred)); | 56 | memset(&inp->ih.cred, 0, sizeof(struct coda_cred)); |
57 | inp->ih.cred.cr_fsuid = current->fsuid; | 57 | inp->ih.cred.cr_fsuid = current->fsuid; |
diff --git a/fs/dlm/user.c b/fs/dlm/user.c index 6438941ab1..4f741546f4 100644 --- a/fs/dlm/user.c +++ b/fs/dlm/user.c | |||
@@ -456,7 +456,7 @@ static int check_version(struct dlm_write_request *req) | |||
456 | printk(KERN_DEBUG "dlm: process %s (%d) version mismatch " | 456 | printk(KERN_DEBUG "dlm: process %s (%d) version mismatch " |
457 | "user (%d.%d.%d) kernel (%d.%d.%d)\n", | 457 | "user (%d.%d.%d) kernel (%d.%d.%d)\n", |
458 | current->comm, | 458 | current->comm, |
459 | current->pid, | 459 | task_pid_nr(current), |
460 | req->version[0], | 460 | req->version[0], |
461 | req->version[1], | 461 | req->version[1], |
462 | req->version[2], | 462 | req->version[2], |
diff --git a/fs/eventpoll.c b/fs/eventpoll.c index de61892919..34f68f3a06 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c | |||
@@ -325,15 +325,14 @@ static void ep_poll_safewake(struct poll_safewake *psw, wait_queue_head_t *wq) | |||
325 | int wake_nests = 0; | 325 | int wake_nests = 0; |
326 | unsigned long flags; | 326 | unsigned long flags; |
327 | struct task_struct *this_task = current; | 327 | struct task_struct *this_task = current; |
328 | struct list_head *lsthead = &psw->wake_task_list, *lnk; | 328 | struct list_head *lsthead = &psw->wake_task_list; |
329 | struct wake_task_node *tncur; | 329 | struct wake_task_node *tncur; |
330 | struct wake_task_node tnode; | 330 | struct wake_task_node tnode; |
331 | 331 | ||
332 | spin_lock_irqsave(&psw->lock, flags); | 332 | spin_lock_irqsave(&psw->lock, flags); |
333 | 333 | ||
334 | /* Try to see if the current task is already inside this wakeup call */ | 334 | /* Try to see if the current task is already inside this wakeup call */ |
335 | list_for_each(lnk, lsthead) { | 335 | list_for_each_entry(tncur, lsthead, llink) { |
336 | tncur = list_entry(lnk, struct wake_task_node, llink); | ||
337 | 336 | ||
338 | if (tncur->wq == wq || | 337 | if (tncur->wq == wq || |
339 | (tncur->task == this_task && ++wake_nests > EP_MAX_POLLWAKE_NESTS)) { | 338 | (tncur->task == this_task && ++wake_nests > EP_MAX_POLLWAKE_NESTS)) { |
@@ -234,7 +234,7 @@ static int __bprm_mm_init(struct linux_binprm *bprm) | |||
234 | vma->vm_start = vma->vm_end - PAGE_SIZE; | 234 | vma->vm_start = vma->vm_end - PAGE_SIZE; |
235 | 235 | ||
236 | vma->vm_flags = VM_STACK_FLAGS; | 236 | vma->vm_flags = VM_STACK_FLAGS; |
237 | vma->vm_page_prot = protection_map[vma->vm_flags & 0x7]; | 237 | vma->vm_page_prot = vm_get_page_prot(vma->vm_flags); |
238 | err = insert_vm_struct(mm, vma); | 238 | err = insert_vm_struct(mm, vma); |
239 | if (err) { | 239 | if (err) { |
240 | up_write(&mm->mmap_sem); | 240 | up_write(&mm->mmap_sem); |
@@ -775,8 +775,8 @@ static int de_thread(struct task_struct *tsk) | |||
775 | * Reparenting needs write_lock on tasklist_lock, | 775 | * Reparenting needs write_lock on tasklist_lock, |
776 | * so it is safe to do it under read_lock. | 776 | * so it is safe to do it under read_lock. |
777 | */ | 777 | */ |
778 | if (unlikely(tsk->group_leader == child_reaper(tsk))) | 778 | if (unlikely(tsk->group_leader == task_child_reaper(tsk))) |
779 | tsk->nsproxy->pid_ns->child_reaper = tsk; | 779 | task_active_pid_ns(tsk)->child_reaper = tsk; |
780 | 780 | ||
781 | zap_other_threads(tsk); | 781 | zap_other_threads(tsk); |
782 | read_unlock(&tasklist_lock); | 782 | read_unlock(&tasklist_lock); |
@@ -841,8 +841,8 @@ static int de_thread(struct task_struct *tsk) | |||
841 | */ | 841 | */ |
842 | tsk->start_time = leader->start_time; | 842 | tsk->start_time = leader->start_time; |
843 | 843 | ||
844 | BUG_ON(leader->tgid != tsk->tgid); | 844 | BUG_ON(!same_thread_group(leader, tsk)); |
845 | BUG_ON(tsk->pid == tsk->tgid); | 845 | BUG_ON(has_group_leader_pid(tsk)); |
846 | /* | 846 | /* |
847 | * An exec() starts a new thread group with the | 847 | * An exec() starts a new thread group with the |
848 | * TGID of the previous thread group. Rehash the | 848 | * TGID of the previous thread group. Rehash the |
@@ -857,7 +857,7 @@ static int de_thread(struct task_struct *tsk) | |||
857 | */ | 857 | */ |
858 | detach_pid(tsk, PIDTYPE_PID); | 858 | detach_pid(tsk, PIDTYPE_PID); |
859 | tsk->pid = leader->pid; | 859 | tsk->pid = leader->pid; |
860 | attach_pid(tsk, PIDTYPE_PID, find_pid(tsk->pid)); | 860 | attach_pid(tsk, PIDTYPE_PID, task_pid(leader)); |
861 | transfer_pid(leader, tsk, PIDTYPE_PGID); | 861 | transfer_pid(leader, tsk, PIDTYPE_PGID); |
862 | transfer_pid(leader, tsk, PIDTYPE_SID); | 862 | transfer_pid(leader, tsk, PIDTYPE_SID); |
863 | list_replace_rcu(&leader->tasks, &tsk->tasks); | 863 | list_replace_rcu(&leader->tasks, &tsk->tasks); |
@@ -1433,7 +1433,7 @@ static int format_corename(char *corename, const char *pattern, long signr) | |||
1433 | case 'p': | 1433 | case 'p': |
1434 | pid_in_pattern = 1; | 1434 | pid_in_pattern = 1; |
1435 | rc = snprintf(out_ptr, out_end - out_ptr, | 1435 | rc = snprintf(out_ptr, out_end - out_ptr, |
1436 | "%d", current->tgid); | 1436 | "%d", task_tgid_vnr(current)); |
1437 | if (rc > out_end - out_ptr) | 1437 | if (rc > out_end - out_ptr) |
1438 | goto out; | 1438 | goto out; |
1439 | out_ptr += rc; | 1439 | out_ptr += rc; |
@@ -1513,7 +1513,7 @@ static int format_corename(char *corename, const char *pattern, long signr) | |||
1513 | if (!ispipe && !pid_in_pattern | 1513 | if (!ispipe && !pid_in_pattern |
1514 | && (core_uses_pid || atomic_read(¤t->mm->mm_users) != 1)) { | 1514 | && (core_uses_pid || atomic_read(¤t->mm->mm_users) != 1)) { |
1515 | rc = snprintf(out_ptr, out_end - out_ptr, | 1515 | rc = snprintf(out_ptr, out_end - out_ptr, |
1516 | ".%d", current->tgid); | 1516 | ".%d", task_tgid_vnr(current)); |
1517 | if (rc > out_end - out_ptr) | 1517 | if (rc > out_end - out_ptr) |
1518 | goto out; | 1518 | goto out; |
1519 | out_ptr += rc; | 1519 | out_ptr += rc; |
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c index 3dec003b77..9b162cd6c1 100644 --- a/fs/ext3/inode.c +++ b/fs/ext3/inode.c | |||
@@ -2954,7 +2954,7 @@ int ext3_write_inode(struct inode *inode, int wait) | |||
2954 | return 0; | 2954 | return 0; |
2955 | 2955 | ||
2956 | if (ext3_journal_current_handle()) { | 2956 | if (ext3_journal_current_handle()) { |
2957 | jbd_debug(0, "called recursively, non-PF_MEMALLOC!\n"); | 2957 | jbd_debug(1, "called recursively, non-PF_MEMALLOC!\n"); |
2958 | dump_stack(); | 2958 | dump_stack(); |
2959 | return -EIO; | 2959 | return -EIO; |
2960 | } | 2960 | } |
diff --git a/fs/ext3/xattr.c b/fs/ext3/xattr.c index f58cbb2632..408373819e 100644 --- a/fs/ext3/xattr.c +++ b/fs/ext3/xattr.c | |||
@@ -741,12 +741,11 @@ ext3_xattr_block_set(handle_t *handle, struct inode *inode, | |||
741 | } | 741 | } |
742 | } else { | 742 | } else { |
743 | /* Allocate a buffer where we construct the new block. */ | 743 | /* Allocate a buffer where we construct the new block. */ |
744 | s->base = kmalloc(sb->s_blocksize, GFP_KERNEL); | 744 | s->base = kzalloc(sb->s_blocksize, GFP_KERNEL); |
745 | /* assert(header == s->base) */ | 745 | /* assert(header == s->base) */ |
746 | error = -ENOMEM; | 746 | error = -ENOMEM; |
747 | if (s->base == NULL) | 747 | if (s->base == NULL) |
748 | goto cleanup; | 748 | goto cleanup; |
749 | memset(s->base, 0, sb->s_blocksize); | ||
750 | header(s->base)->h_magic = cpu_to_le32(EXT3_XATTR_MAGIC); | 749 | header(s->base)->h_magic = cpu_to_le32(EXT3_XATTR_MAGIC); |
751 | header(s->base)->h_blocks = cpu_to_le32(1); | 750 | header(s->base)->h_blocks = cpu_to_le32(1); |
752 | header(s->base)->h_refcount = cpu_to_le32(1); | 751 | header(s->base)->h_refcount = cpu_to_le32(1); |
diff --git a/fs/fcntl.c b/fs/fcntl.c index c9db73fc5e..8685263ccc 100644 --- a/fs/fcntl.c +++ b/fs/fcntl.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/ptrace.h> | 18 | #include <linux/ptrace.h> |
19 | #include <linux/signal.h> | 19 | #include <linux/signal.h> |
20 | #include <linux/rcupdate.h> | 20 | #include <linux/rcupdate.h> |
21 | #include <linux/pid_namespace.h> | ||
21 | 22 | ||
22 | #include <asm/poll.h> | 23 | #include <asm/poll.h> |
23 | #include <asm/siginfo.h> | 24 | #include <asm/siginfo.h> |
@@ -292,7 +293,7 @@ int f_setown(struct file *filp, unsigned long arg, int force) | |||
292 | who = -who; | 293 | who = -who; |
293 | } | 294 | } |
294 | rcu_read_lock(); | 295 | rcu_read_lock(); |
295 | pid = find_pid(who); | 296 | pid = find_vpid(who); |
296 | result = __f_setown(filp, pid, type, force); | 297 | result = __f_setown(filp, pid, type, force); |
297 | rcu_read_unlock(); | 298 | rcu_read_unlock(); |
298 | return result; | 299 | return result; |
@@ -308,7 +309,7 @@ pid_t f_getown(struct file *filp) | |||
308 | { | 309 | { |
309 | pid_t pid; | 310 | pid_t pid; |
310 | read_lock(&filp->f_owner.lock); | 311 | read_lock(&filp->f_owner.lock); |
311 | pid = pid_nr(filp->f_owner.pid); | 312 | pid = pid_nr_ns(filp->f_owner.pid, current->nsproxy->pid_ns); |
312 | if (filp->f_owner.pid_type == PIDTYPE_PGID) | 313 | if (filp->f_owner.pid_type == PIDTYPE_PGID) |
313 | pid = -pid; | 314 | pid = -pid; |
314 | read_unlock(&filp->f_owner.lock); | 315 | read_unlock(&filp->f_owner.lock); |
diff --git a/fs/file_table.c b/fs/file_table.c index 3176fefc92..664e3f2309 100644 --- a/fs/file_table.c +++ b/fs/file_table.c | |||
@@ -323,12 +323,11 @@ void file_kill(struct file *file) | |||
323 | 323 | ||
324 | int fs_may_remount_ro(struct super_block *sb) | 324 | int fs_may_remount_ro(struct super_block *sb) |
325 | { | 325 | { |
326 | struct list_head *p; | 326 | struct file *file; |
327 | 327 | ||
328 | /* Check that no files are currently opened for writing. */ | 328 | /* Check that no files are currently opened for writing. */ |
329 | file_list_lock(); | 329 | file_list_lock(); |
330 | list_for_each(p, &sb->s_files) { | 330 | list_for_each_entry(file, &sb->s_files, f_u.fu_list) { |
331 | struct file *file = list_entry(p, struct file, f_u.fu_list); | ||
332 | struct inode *inode = file->f_path.dentry->d_inode; | 331 | struct inode *inode = file->f_path.dentry->d_inode; |
333 | 332 | ||
334 | /* File with pending delete? */ | 333 | /* File with pending delete? */ |
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 686734ff97..0fca82021d 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c | |||
@@ -89,7 +89,7 @@ void __mark_inode_dirty(struct inode *inode, int flags) | |||
89 | if (inode->i_ino || strcmp(inode->i_sb->s_id, "bdev")) | 89 | if (inode->i_ino || strcmp(inode->i_sb->s_id, "bdev")) |
90 | printk(KERN_DEBUG | 90 | printk(KERN_DEBUG |
91 | "%s(%d): dirtied inode %lu (%s) on %s\n", | 91 | "%s(%d): dirtied inode %lu (%s) on %s\n", |
92 | current->comm, current->pid, inode->i_ino, | 92 | current->comm, task_pid_nr(current), inode->i_ino, |
93 | name, inode->i_sb->s_id); | 93 | name, inode->i_sb->s_id); |
94 | } | 94 | } |
95 | 95 | ||
diff --git a/fs/ioprio.c b/fs/ioprio.c index 10d2c211d1..d6ff77e8e7 100644 --- a/fs/ioprio.c +++ b/fs/ioprio.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/capability.h> | 25 | #include <linux/capability.h> |
26 | #include <linux/syscalls.h> | 26 | #include <linux/syscalls.h> |
27 | #include <linux/security.h> | 27 | #include <linux/security.h> |
28 | #include <linux/pid_namespace.h> | ||
28 | 29 | ||
29 | static int set_task_ioprio(struct task_struct *task, int ioprio) | 30 | static int set_task_ioprio(struct task_struct *task, int ioprio) |
30 | { | 31 | { |
@@ -93,7 +94,7 @@ asmlinkage long sys_ioprio_set(int which, int who, int ioprio) | |||
93 | if (!who) | 94 | if (!who) |
94 | p = current; | 95 | p = current; |
95 | else | 96 | else |
96 | p = find_task_by_pid(who); | 97 | p = find_task_by_vpid(who); |
97 | if (p) | 98 | if (p) |
98 | ret = set_task_ioprio(p, ioprio); | 99 | ret = set_task_ioprio(p, ioprio); |
99 | break; | 100 | break; |
@@ -101,7 +102,7 @@ asmlinkage long sys_ioprio_set(int which, int who, int ioprio) | |||
101 | if (!who) | 102 | if (!who) |
102 | pgrp = task_pgrp(current); | 103 | pgrp = task_pgrp(current); |
103 | else | 104 | else |
104 | pgrp = find_pid(who); | 105 | pgrp = find_vpid(who); |
105 | do_each_pid_task(pgrp, PIDTYPE_PGID, p) { | 106 | do_each_pid_task(pgrp, PIDTYPE_PGID, p) { |
106 | ret = set_task_ioprio(p, ioprio); | 107 | ret = set_task_ioprio(p, ioprio); |
107 | if (ret) | 108 | if (ret) |
@@ -180,7 +181,7 @@ asmlinkage long sys_ioprio_get(int which, int who) | |||
180 | if (!who) | 181 | if (!who) |
181 | p = current; | 182 | p = current; |
182 | else | 183 | else |
183 | p = find_task_by_pid(who); | 184 | p = find_task_by_vpid(who); |
184 | if (p) | 185 | if (p) |
185 | ret = get_task_ioprio(p); | 186 | ret = get_task_ioprio(p); |
186 | break; | 187 | break; |
@@ -188,7 +189,7 @@ asmlinkage long sys_ioprio_get(int which, int who) | |||
188 | if (!who) | 189 | if (!who) |
189 | pgrp = task_pgrp(current); | 190 | pgrp = task_pgrp(current); |
190 | else | 191 | else |
191 | pgrp = find_pid(who); | 192 | pgrp = find_vpid(who); |
192 | do_each_pid_task(pgrp, PIDTYPE_PGID, p) { | 193 | do_each_pid_task(pgrp, PIDTYPE_PGID, p) { |
193 | tmpio = get_task_ioprio(p); | 194 | tmpio = get_task_ioprio(p); |
194 | if (tmpio < 0) | 195 | if (tmpio < 0) |
diff --git a/fs/jbd/commit.c b/fs/jbd/commit.c index a263d82761..8f1f2aa5fb 100644 --- a/fs/jbd/commit.c +++ b/fs/jbd/commit.c | |||
@@ -466,7 +466,7 @@ void journal_commit_transaction(journal_t *journal) | |||
466 | spin_unlock(&journal->j_list_lock); | 466 | spin_unlock(&journal->j_list_lock); |
467 | 467 | ||
468 | if (err) | 468 | if (err) |
469 | __journal_abort_hard(journal); | 469 | journal_abort(journal, err); |
470 | 470 | ||
471 | journal_write_revoke_records(journal, commit_transaction); | 471 | journal_write_revoke_records(journal, commit_transaction); |
472 | 472 | ||
@@ -524,7 +524,7 @@ void journal_commit_transaction(journal_t *journal) | |||
524 | 524 | ||
525 | descriptor = journal_get_descriptor_buffer(journal); | 525 | descriptor = journal_get_descriptor_buffer(journal); |
526 | if (!descriptor) { | 526 | if (!descriptor) { |
527 | __journal_abort_hard(journal); | 527 | journal_abort(journal, -EIO); |
528 | continue; | 528 | continue; |
529 | } | 529 | } |
530 | 530 | ||
@@ -557,7 +557,7 @@ void journal_commit_transaction(journal_t *journal) | |||
557 | and repeat this loop: we'll fall into the | 557 | and repeat this loop: we'll fall into the |
558 | refile-on-abort condition above. */ | 558 | refile-on-abort condition above. */ |
559 | if (err) { | 559 | if (err) { |
560 | __journal_abort_hard(journal); | 560 | journal_abort(journal, err); |
561 | continue; | 561 | continue; |
562 | } | 562 | } |
563 | 563 | ||
@@ -748,7 +748,7 @@ wait_for_iobuf: | |||
748 | err = -EIO; | 748 | err = -EIO; |
749 | 749 | ||
750 | if (err) | 750 | if (err) |
751 | __journal_abort_hard(journal); | 751 | journal_abort(journal, err); |
752 | 752 | ||
753 | /* End of a transaction! Finally, we can do checkpoint | 753 | /* End of a transaction! Finally, we can do checkpoint |
754 | processing: any buffers committed as a result of this | 754 | processing: any buffers committed as a result of this |
diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c index 5d9fec0b7e..5d14243499 100644 --- a/fs/jbd/journal.c +++ b/fs/jbd/journal.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/kthread.h> | 35 | #include <linux/kthread.h> |
36 | #include <linux/poison.h> | 36 | #include <linux/poison.h> |
37 | #include <linux/proc_fs.h> | 37 | #include <linux/proc_fs.h> |
38 | #include <linux/debugfs.h> | ||
38 | 39 | ||
39 | #include <asm/uaccess.h> | 40 | #include <asm/uaccess.h> |
40 | #include <asm/page.h> | 41 | #include <asm/page.h> |
@@ -654,10 +655,9 @@ static journal_t * journal_init_common (void) | |||
654 | journal_t *journal; | 655 | journal_t *journal; |
655 | int err; | 656 | int err; |
656 | 657 | ||
657 | journal = kmalloc(sizeof(*journal), GFP_KERNEL); | 658 | journal = kzalloc(sizeof(*journal), GFP_KERNEL); |
658 | if (!journal) | 659 | if (!journal) |
659 | goto fail; | 660 | goto fail; |
660 | memset(journal, 0, sizeof(*journal)); | ||
661 | 661 | ||
662 | init_waitqueue_head(&journal->j_wait_transaction_locked); | 662 | init_waitqueue_head(&journal->j_wait_transaction_locked); |
663 | init_waitqueue_head(&journal->j_wait_logspace); | 663 | init_waitqueue_head(&journal->j_wait_logspace); |
@@ -1852,64 +1852,41 @@ void journal_put_journal_head(struct journal_head *jh) | |||
1852 | } | 1852 | } |
1853 | 1853 | ||
1854 | /* | 1854 | /* |
1855 | * /proc tunables | 1855 | * debugfs tunables |
1856 | */ | 1856 | */ |
1857 | #if defined(CONFIG_JBD_DEBUG) | 1857 | #ifdef CONFIG_JBD_DEBUG |
1858 | int journal_enable_debug; | ||
1859 | EXPORT_SYMBOL(journal_enable_debug); | ||
1860 | #endif | ||
1861 | 1858 | ||
1862 | #if defined(CONFIG_JBD_DEBUG) && defined(CONFIG_PROC_FS) | 1859 | u8 journal_enable_debug __read_mostly; |
1860 | EXPORT_SYMBOL(journal_enable_debug); | ||
1863 | 1861 | ||
1864 | static struct proc_dir_entry *proc_jbd_debug; | 1862 | static struct dentry *jbd_debugfs_dir; |
1863 | static struct dentry *jbd_debug; | ||
1865 | 1864 | ||
1866 | static int read_jbd_debug(char *page, char **start, off_t off, | 1865 | static void __init jbd_create_debugfs_entry(void) |
1867 | int count, int *eof, void *data) | ||
1868 | { | 1866 | { |
1869 | int ret; | 1867 | jbd_debugfs_dir = debugfs_create_dir("jbd", NULL); |
1870 | 1868 | if (jbd_debugfs_dir) | |
1871 | ret = sprintf(page + off, "%d\n", journal_enable_debug); | 1869 | jbd_debug = debugfs_create_u8("jbd-debug", S_IRUGO, |
1872 | *eof = 1; | 1870 | jbd_debugfs_dir, |
1873 | return ret; | 1871 | &journal_enable_debug); |
1874 | } | 1872 | } |
1875 | 1873 | ||
1876 | static int write_jbd_debug(struct file *file, const char __user *buffer, | 1874 | static void __exit jbd_remove_debugfs_entry(void) |
1877 | unsigned long count, void *data) | ||
1878 | { | 1875 | { |
1879 | char buf[32]; | 1876 | debugfs_remove(jbd_debug); |
1880 | 1877 | debugfs_remove(jbd_debugfs_dir); | |
1881 | if (count > ARRAY_SIZE(buf) - 1) | ||
1882 | count = ARRAY_SIZE(buf) - 1; | ||
1883 | if (copy_from_user(buf, buffer, count)) | ||
1884 | return -EFAULT; | ||
1885 | buf[ARRAY_SIZE(buf) - 1] = '\0'; | ||
1886 | journal_enable_debug = simple_strtoul(buf, NULL, 10); | ||
1887 | return count; | ||
1888 | } | 1878 | } |
1889 | 1879 | ||
1890 | #define JBD_PROC_NAME "sys/fs/jbd-debug" | 1880 | #else |
1891 | 1881 | ||
1892 | static void __init create_jbd_proc_entry(void) | 1882 | static inline void jbd_create_debugfs_entry(void) |
1893 | { | 1883 | { |
1894 | proc_jbd_debug = create_proc_entry(JBD_PROC_NAME, 0644, NULL); | ||
1895 | if (proc_jbd_debug) { | ||
1896 | /* Why is this so hard? */ | ||
1897 | proc_jbd_debug->read_proc = read_jbd_debug; | ||
1898 | proc_jbd_debug->write_proc = write_jbd_debug; | ||
1899 | } | ||
1900 | } | 1884 | } |
1901 | 1885 | ||
1902 | static void __exit remove_jbd_proc_entry(void) | 1886 | static inline void jbd_remove_debugfs_entry(void) |
1903 | { | 1887 | { |
1904 | if (proc_jbd_debug) | ||
1905 | remove_proc_entry(JBD_PROC_NAME, NULL); | ||
1906 | } | 1888 | } |
1907 | 1889 | ||
1908 | #else | ||
1909 | |||
1910 | #define create_jbd_proc_entry() do {} while (0) | ||
1911 | #define remove_jbd_proc_entry() do {} while (0) | ||
1912 | |||
1913 | #endif | 1890 | #endif |
1914 | 1891 | ||
1915 | struct kmem_cache *jbd_handle_cache; | 1892 | struct kmem_cache *jbd_handle_cache; |
@@ -1966,7 +1943,7 @@ static int __init journal_init(void) | |||
1966 | ret = journal_init_caches(); | 1943 | ret = journal_init_caches(); |
1967 | if (ret != 0) | 1944 | if (ret != 0) |
1968 | journal_destroy_caches(); | 1945 | journal_destroy_caches(); |
1969 | create_jbd_proc_entry(); | 1946 | jbd_create_debugfs_entry(); |
1970 | return ret; | 1947 | return ret; |
1971 | } | 1948 | } |
1972 | 1949 | ||
@@ -1977,7 +1954,7 @@ static void __exit journal_exit(void) | |||
1977 | if (n) | 1954 | if (n) |
1978 | printk(KERN_EMERG "JBD: leaked %d journal_heads!\n", n); | 1955 | printk(KERN_EMERG "JBD: leaked %d journal_heads!\n", n); |
1979 | #endif | 1956 | #endif |
1980 | remove_jbd_proc_entry(); | 1957 | jbd_remove_debugfs_entry(); |
1981 | journal_destroy_caches(); | 1958 | journal_destroy_caches(); |
1982 | } | 1959 | } |
1983 | 1960 | ||
diff --git a/fs/jbd/recovery.c b/fs/jbd/recovery.c index 2a5f4b833e..c5d9694b6a 100644 --- a/fs/jbd/recovery.c +++ b/fs/jbd/recovery.c | |||
@@ -250,10 +250,10 @@ int journal_recover(journal_t *journal) | |||
250 | if (!err) | 250 | if (!err) |
251 | err = do_one_pass(journal, &info, PASS_REPLAY); | 251 | err = do_one_pass(journal, &info, PASS_REPLAY); |
252 | 252 | ||
253 | jbd_debug(0, "JBD: recovery, exit status %d, " | 253 | jbd_debug(1, "JBD: recovery, exit status %d, " |
254 | "recovered transactions %u to %u\n", | 254 | "recovered transactions %u to %u\n", |
255 | err, info.start_transaction, info.end_transaction); | 255 | err, info.start_transaction, info.end_transaction); |
256 | jbd_debug(0, "JBD: Replayed %d and revoked %d/%d blocks\n", | 256 | jbd_debug(1, "JBD: Replayed %d and revoked %d/%d blocks\n", |
257 | info.nr_replays, info.nr_revoke_hits, info.nr_revokes); | 257 | info.nr_replays, info.nr_revoke_hits, info.nr_revokes); |
258 | 258 | ||
259 | /* Restart the log at the next transaction ID, thus invalidating | 259 | /* Restart the log at the next transaction ID, thus invalidating |
@@ -297,7 +297,7 @@ int journal_skip_recovery(journal_t *journal) | |||
297 | #ifdef CONFIG_JBD_DEBUG | 297 | #ifdef CONFIG_JBD_DEBUG |
298 | int dropped = info.end_transaction - be32_to_cpu(sb->s_sequence); | 298 | int dropped = info.end_transaction - be32_to_cpu(sb->s_sequence); |
299 | #endif | 299 | #endif |
300 | jbd_debug(0, | 300 | jbd_debug(1, |
301 | "JBD: ignoring %d transaction%s from the journal.\n", | 301 | "JBD: ignoring %d transaction%s from the journal.\n", |
302 | dropped, (dropped == 1) ? "" : "s"); | 302 | dropped, (dropped == 1) ? "" : "s"); |
303 | journal->j_transaction_sequence = ++info.end_transaction; | 303 | journal->j_transaction_sequence = ++info.end_transaction; |
diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c index 9841b1e5af..08ff6c7028 100644 --- a/fs/jbd/transaction.c +++ b/fs/jbd/transaction.c | |||
@@ -96,13 +96,12 @@ static int start_this_handle(journal_t *journal, handle_t *handle) | |||
96 | 96 | ||
97 | alloc_transaction: | 97 | alloc_transaction: |
98 | if (!journal->j_running_transaction) { | 98 | if (!journal->j_running_transaction) { |
99 | new_transaction = kmalloc(sizeof(*new_transaction), | 99 | new_transaction = kzalloc(sizeof(*new_transaction), |
100 | GFP_NOFS|__GFP_NOFAIL); | 100 | GFP_NOFS|__GFP_NOFAIL); |
101 | if (!new_transaction) { | 101 | if (!new_transaction) { |
102 | ret = -ENOMEM; | 102 | ret = -ENOMEM; |
103 | goto out; | 103 | goto out; |
104 | } | 104 | } |
105 | memset(new_transaction, 0, sizeof(*new_transaction)); | ||
106 | } | 105 | } |
107 | 106 | ||
108 | jbd_debug(3, "New handle %p going live.\n", handle); | 107 | jbd_debug(3, "New handle %p going live.\n", handle); |
diff --git a/fs/jffs2/debug.h b/fs/jffs2/debug.h index 2a49f2c51a..4130adabd7 100644 --- a/fs/jffs2/debug.h +++ b/fs/jffs2/debug.h | |||
@@ -80,28 +80,28 @@ | |||
80 | #define JFFS2_ERROR(fmt, ...) \ | 80 | #define JFFS2_ERROR(fmt, ...) \ |
81 | do { \ | 81 | do { \ |
82 | printk(JFFS2_ERR_MSG_PREFIX \ | 82 | printk(JFFS2_ERR_MSG_PREFIX \ |
83 | " (%d) %s: " fmt, current->pid, \ | 83 | " (%d) %s: " fmt, task_pid_nr(current), \ |
84 | __FUNCTION__ , ##__VA_ARGS__); \ | 84 | __FUNCTION__ , ##__VA_ARGS__); \ |
85 | } while(0) | 85 | } while(0) |
86 | 86 | ||
87 | #define JFFS2_WARNING(fmt, ...) \ | 87 | #define JFFS2_WARNING(fmt, ...) \ |
88 | do { \ | 88 | do { \ |
89 | printk(JFFS2_WARN_MSG_PREFIX \ | 89 | printk(JFFS2_WARN_MSG_PREFIX \ |
90 | " (%d) %s: " fmt, current->pid, \ | 90 | " (%d) %s: " fmt, task_pid_nr(current), \ |
91 | __FUNCTION__ , ##__VA_ARGS__); \ | 91 | __FUNCTION__ , ##__VA_ARGS__); \ |
92 | } while(0) | 92 | } while(0) |
93 | 93 | ||
94 | #define JFFS2_NOTICE(fmt, ...) \ | 94 | #define JFFS2_NOTICE(fmt, ...) \ |
95 | do { \ | 95 | do { \ |
96 | printk(JFFS2_NOTICE_MSG_PREFIX \ | 96 | printk(JFFS2_NOTICE_MSG_PREFIX \ |
97 | " (%d) %s: " fmt, current->pid, \ | 97 | " (%d) %s: " fmt, task_pid_nr(current), \ |
98 | __FUNCTION__ , ##__VA_ARGS__); \ | 98 | __FUNCTION__ , ##__VA_ARGS__); \ |
99 | } while(0) | 99 | } while(0) |
100 | 100 | ||
101 | #define JFFS2_DEBUG(fmt, ...) \ | 101 | #define JFFS2_DEBUG(fmt, ...) \ |
102 | do { \ | 102 | do { \ |
103 | printk(JFFS2_DBG_MSG_PREFIX \ | 103 | printk(JFFS2_DBG_MSG_PREFIX \ |
104 | " (%d) %s: " fmt, current->pid, \ | 104 | " (%d) %s: " fmt, task_pid_nr(current), \ |
105 | __FUNCTION__ , ##__VA_ARGS__); \ | 105 | __FUNCTION__ , ##__VA_ARGS__); \ |
106 | } while(0) | 106 | } while(0) |
107 | 107 | ||
diff --git a/fs/namespace.c b/fs/namespace.c index 07daa79725..860752998f 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -1411,7 +1411,7 @@ long do_mount(char *dev_name, char *dir_name, char *type_page, | |||
1411 | mnt_flags |= MNT_RELATIME; | 1411 | mnt_flags |= MNT_RELATIME; |
1412 | 1412 | ||
1413 | flags &= ~(MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_ACTIVE | | 1413 | flags &= ~(MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_ACTIVE | |
1414 | MS_NOATIME | MS_NODIRATIME | MS_RELATIME); | 1414 | MS_NOATIME | MS_NODIRATIME | MS_RELATIME| MS_KERNMOUNT); |
1415 | 1415 | ||
1416 | /* ... and get the mountpoint */ | 1416 | /* ... and get the mountpoint */ |
1417 | retval = path_lookup(dir_name, LOOKUP_FOLLOW, &nd); | 1417 | retval = path_lookup(dir_name, LOOKUP_FOLLOW, &nd); |
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 46934c97f8..d019918992 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
@@ -1029,13 +1029,13 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, | |||
1029 | if (EX_WGATHER(exp)) { | 1029 | if (EX_WGATHER(exp)) { |
1030 | if (atomic_read(&inode->i_writecount) > 1 | 1030 | if (atomic_read(&inode->i_writecount) > 1 |
1031 | || (last_ino == inode->i_ino && last_dev == inode->i_sb->s_dev)) { | 1031 | || (last_ino == inode->i_ino && last_dev == inode->i_sb->s_dev)) { |
1032 | dprintk("nfsd: write defer %d\n", current->pid); | 1032 | dprintk("nfsd: write defer %d\n", task_pid_nr(current)); |
1033 | msleep(10); | 1033 | msleep(10); |
1034 | dprintk("nfsd: write resume %d\n", current->pid); | 1034 | dprintk("nfsd: write resume %d\n", task_pid_nr(current)); |
1035 | } | 1035 | } |
1036 | 1036 | ||
1037 | if (inode->i_state & I_DIRTY) { | 1037 | if (inode->i_state & I_DIRTY) { |
1038 | dprintk("nfsd: write sync %d\n", current->pid); | 1038 | dprintk("nfsd: write sync %d\n", task_pid_nr(current)); |
1039 | host_err=nfsd_sync(file); | 1039 | host_err=nfsd_sync(file); |
1040 | } | 1040 | } |
1041 | #if 0 | 1041 | #if 0 |
diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c index f14b541fab..9cc7c0418b 100644 --- a/fs/ocfs2/cluster/heartbeat.c +++ b/fs/ocfs2/cluster/heartbeat.c | |||
@@ -1372,7 +1372,7 @@ static ssize_t o2hb_region_pid_read(struct o2hb_region *reg, | |||
1372 | 1372 | ||
1373 | spin_lock(&o2hb_live_lock); | 1373 | spin_lock(&o2hb_live_lock); |
1374 | if (reg->hr_task) | 1374 | if (reg->hr_task) |
1375 | pid = reg->hr_task->pid; | 1375 | pid = task_pid_nr(reg->hr_task); |
1376 | spin_unlock(&o2hb_live_lock); | 1376 | spin_unlock(&o2hb_live_lock); |
1377 | 1377 | ||
1378 | if (!pid) | 1378 | if (!pid) |
diff --git a/fs/ocfs2/cluster/masklog.h b/fs/ocfs2/cluster/masklog.h index 75cd877f6d..cd04606011 100644 --- a/fs/ocfs2/cluster/masklog.h +++ b/fs/ocfs2/cluster/masklog.h | |||
@@ -192,7 +192,7 @@ extern struct mlog_bits mlog_and_bits, mlog_not_bits; | |||
192 | * previous token if args expands to nothing. | 192 | * previous token if args expands to nothing. |
193 | */ | 193 | */ |
194 | #define __mlog_printk(level, fmt, args...) \ | 194 | #define __mlog_printk(level, fmt, args...) \ |
195 | printk(level "(%u,%lu):%s:%d " fmt, current->pid, \ | 195 | printk(level "(%u,%lu):%s:%d " fmt, task_pid_nr(current), \ |
196 | __mlog_cpu_guess, __PRETTY_FUNCTION__, __LINE__ , \ | 196 | __mlog_cpu_guess, __PRETTY_FUNCTION__, __LINE__ , \ |
197 | ##args) | 197 | ##args) |
198 | 198 | ||
diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c index a2c33160bf..2fde7bf914 100644 --- a/fs/ocfs2/dlm/dlmrecovery.c +++ b/fs/ocfs2/dlm/dlmrecovery.c | |||
@@ -259,7 +259,7 @@ static void dlm_print_reco_node_status(struct dlm_ctxt *dlm) | |||
259 | struct dlm_lock_resource *res; | 259 | struct dlm_lock_resource *res; |
260 | 260 | ||
261 | mlog(ML_NOTICE, "%s(%d): recovery info, state=%s, dead=%u, master=%u\n", | 261 | mlog(ML_NOTICE, "%s(%d): recovery info, state=%s, dead=%u, master=%u\n", |
262 | dlm->name, dlm->dlm_reco_thread_task->pid, | 262 | dlm->name, task_pid_nr(dlm->dlm_reco_thread_task), |
263 | dlm->reco.state & DLM_RECO_STATE_ACTIVE ? "ACTIVE" : "inactive", | 263 | dlm->reco.state & DLM_RECO_STATE_ACTIVE ? "ACTIVE" : "inactive", |
264 | dlm->reco.dead_node, dlm->reco.new_master); | 264 | dlm->reco.dead_node, dlm->reco.new_master); |
265 | 265 | ||
@@ -420,7 +420,7 @@ void dlm_wait_for_recovery(struct dlm_ctxt *dlm) | |||
420 | if (dlm_in_recovery(dlm)) { | 420 | if (dlm_in_recovery(dlm)) { |
421 | mlog(0, "%s: reco thread %d in recovery: " | 421 | mlog(0, "%s: reco thread %d in recovery: " |
422 | "state=%d, master=%u, dead=%u\n", | 422 | "state=%d, master=%u, dead=%u\n", |
423 | dlm->name, dlm->dlm_reco_thread_task->pid, | 423 | dlm->name, task_pid_nr(dlm->dlm_reco_thread_task), |
424 | dlm->reco.state, dlm->reco.new_master, | 424 | dlm->reco.state, dlm->reco.new_master, |
425 | dlm->reco.dead_node); | 425 | dlm->reco.dead_node); |
426 | } | 426 | } |
@@ -483,7 +483,7 @@ static int dlm_do_recovery(struct dlm_ctxt *dlm) | |||
483 | return 0; | 483 | return 0; |
484 | } | 484 | } |
485 | mlog(0, "%s(%d):recovery thread found node %u in the recovery map!\n", | 485 | mlog(0, "%s(%d):recovery thread found node %u in the recovery map!\n", |
486 | dlm->name, dlm->dlm_reco_thread_task->pid, | 486 | dlm->name, task_pid_nr(dlm->dlm_reco_thread_task), |
487 | dlm->reco.dead_node); | 487 | dlm->reco.dead_node); |
488 | spin_unlock(&dlm->spinlock); | 488 | spin_unlock(&dlm->spinlock); |
489 | 489 | ||
@@ -507,7 +507,7 @@ static int dlm_do_recovery(struct dlm_ctxt *dlm) | |||
507 | mlog(0, "another node will master this recovery session.\n"); | 507 | mlog(0, "another node will master this recovery session.\n"); |
508 | } | 508 | } |
509 | mlog(0, "dlm=%s (%d), new_master=%u, this node=%u, dead_node=%u\n", | 509 | mlog(0, "dlm=%s (%d), new_master=%u, this node=%u, dead_node=%u\n", |
510 | dlm->name, dlm->dlm_reco_thread_task->pid, dlm->reco.new_master, | 510 | dlm->name, task_pid_nr(dlm->dlm_reco_thread_task), dlm->reco.new_master, |
511 | dlm->node_num, dlm->reco.dead_node); | 511 | dlm->node_num, dlm->reco.dead_node); |
512 | 512 | ||
513 | /* it is safe to start everything back up here | 513 | /* it is safe to start everything back up here |
@@ -520,7 +520,7 @@ static int dlm_do_recovery(struct dlm_ctxt *dlm) | |||
520 | 520 | ||
521 | master_here: | 521 | master_here: |
522 | mlog(0, "(%d) mastering recovery of %s:%u here(this=%u)!\n", | 522 | mlog(0, "(%d) mastering recovery of %s:%u here(this=%u)!\n", |
523 | dlm->dlm_reco_thread_task->pid, | 523 | task_pid_nr(dlm->dlm_reco_thread_task), |
524 | dlm->name, dlm->reco.dead_node, dlm->node_num); | 524 | dlm->name, dlm->reco.dead_node, dlm->node_num); |
525 | 525 | ||
526 | status = dlm_remaster_locks(dlm, dlm->reco.dead_node); | 526 | status = dlm_remaster_locks(dlm, dlm->reco.dead_node); |
diff --git a/fs/proc/array.c b/fs/proc/array.c index 27b59f5f3b..7a34571203 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c | |||
@@ -77,6 +77,7 @@ | |||
77 | #include <linux/cpuset.h> | 77 | #include <linux/cpuset.h> |
78 | #include <linux/rcupdate.h> | 78 | #include <linux/rcupdate.h> |
79 | #include <linux/delayacct.h> | 79 | #include <linux/delayacct.h> |
80 | #include <linux/pid_namespace.h> | ||
80 | 81 | ||
81 | #include <asm/pgtable.h> | 82 | #include <asm/pgtable.h> |
82 | #include <asm/processor.h> | 83 | #include <asm/processor.h> |
@@ -145,8 +146,7 @@ static inline const char *get_task_state(struct task_struct *tsk) | |||
145 | TASK_UNINTERRUPTIBLE | | 146 | TASK_UNINTERRUPTIBLE | |
146 | TASK_STOPPED | | 147 | TASK_STOPPED | |
147 | TASK_TRACED)) | | 148 | TASK_TRACED)) | |
148 | (tsk->exit_state & (EXIT_ZOMBIE | | 149 | tsk->exit_state; |
149 | EXIT_DEAD)); | ||
150 | const char **p = &task_state_array[0]; | 150 | const char **p = &task_state_array[0]; |
151 | 151 | ||
152 | while (state) { | 152 | while (state) { |
@@ -161,8 +161,15 @@ static inline char *task_state(struct task_struct *p, char *buffer) | |||
161 | struct group_info *group_info; | 161 | struct group_info *group_info; |
162 | int g; | 162 | int g; |
163 | struct fdtable *fdt = NULL; | 163 | struct fdtable *fdt = NULL; |
164 | struct pid_namespace *ns; | ||
165 | pid_t ppid, tpid; | ||
164 | 166 | ||
167 | ns = current->nsproxy->pid_ns; | ||
165 | rcu_read_lock(); | 168 | rcu_read_lock(); |
169 | ppid = pid_alive(p) ? | ||
170 | task_tgid_nr_ns(rcu_dereference(p->real_parent), ns) : 0; | ||
171 | tpid = pid_alive(p) && p->ptrace ? | ||
172 | task_ppid_nr_ns(rcu_dereference(p->parent), ns) : 0; | ||
166 | buffer += sprintf(buffer, | 173 | buffer += sprintf(buffer, |
167 | "State:\t%s\n" | 174 | "State:\t%s\n" |
168 | "Tgid:\t%d\n" | 175 | "Tgid:\t%d\n" |
@@ -172,9 +179,9 @@ static inline char *task_state(struct task_struct *p, char *buffer) | |||
172 | "Uid:\t%d\t%d\t%d\t%d\n" | 179 | "Uid:\t%d\t%d\t%d\t%d\n" |
173 | "Gid:\t%d\t%d\t%d\t%d\n", | 180 | "Gid:\t%d\t%d\t%d\t%d\n", |
174 | get_task_state(p), | 181 | get_task_state(p), |
175 | p->tgid, p->pid, | 182 | task_tgid_nr_ns(p, ns), |
176 | pid_alive(p) ? rcu_dereference(p->real_parent)->tgid : 0, | 183 | task_pid_nr_ns(p, ns), |
177 | pid_alive(p) && p->ptrace ? rcu_dereference(p->parent)->pid : 0, | 184 | ppid, tpid, |
178 | p->uid, p->euid, p->suid, p->fsuid, | 185 | p->uid, p->euid, p->suid, p->fsuid, |
179 | p->gid, p->egid, p->sgid, p->fsgid); | 186 | p->gid, p->egid, p->sgid, p->fsgid); |
180 | 187 | ||
@@ -394,6 +401,9 @@ static int do_task_stat(struct task_struct *task, char *buffer, int whole) | |||
394 | unsigned long rsslim = 0; | 401 | unsigned long rsslim = 0; |
395 | char tcomm[sizeof(task->comm)]; | 402 | char tcomm[sizeof(task->comm)]; |
396 | unsigned long flags; | 403 | unsigned long flags; |
404 | struct pid_namespace *ns; | ||
405 | |||
406 | ns = current->nsproxy->pid_ns; | ||
397 | 407 | ||
398 | state = *get_task_state(task); | 408 | state = *get_task_state(task); |
399 | vsize = eip = esp = 0; | 409 | vsize = eip = esp = 0; |
@@ -416,7 +426,7 @@ static int do_task_stat(struct task_struct *task, char *buffer, int whole) | |||
416 | struct signal_struct *sig = task->signal; | 426 | struct signal_struct *sig = task->signal; |
417 | 427 | ||
418 | if (sig->tty) { | 428 | if (sig->tty) { |
419 | tty_pgrp = pid_nr(sig->tty->pgrp); | 429 | tty_pgrp = pid_nr_ns(sig->tty->pgrp, ns); |
420 | tty_nr = new_encode_dev(tty_devnum(sig->tty)); | 430 | tty_nr = new_encode_dev(tty_devnum(sig->tty)); |
421 | } | 431 | } |
422 | 432 | ||
@@ -449,9 +459,9 @@ static int do_task_stat(struct task_struct *task, char *buffer, int whole) | |||
449 | gtime += cputime_add(gtime, sig->gtime); | 459 | gtime += cputime_add(gtime, sig->gtime); |
450 | } | 460 | } |
451 | 461 | ||
452 | sid = signal_session(sig); | 462 | sid = task_session_nr_ns(task, ns); |
453 | pgid = process_group(task); | 463 | pgid = task_pgrp_nr_ns(task, ns); |
454 | ppid = rcu_dereference(task->real_parent)->tgid; | 464 | ppid = task_ppid_nr_ns(task, ns); |
455 | 465 | ||
456 | unlock_task_sighand(task, &flags); | 466 | unlock_task_sighand(task, &flags); |
457 | } | 467 | } |
@@ -483,7 +493,7 @@ static int do_task_stat(struct task_struct *task, char *buffer, int whole) | |||
483 | res = sprintf(buffer, "%d (%s) %c %d %d %d %d %d %u %lu \ | 493 | res = sprintf(buffer, "%d (%s) %c %d %d %d %d %d %u %lu \ |
484 | %lu %lu %lu %lu %lu %ld %ld %ld %ld %d 0 %llu %lu %ld %lu %lu %lu %lu %lu \ | 494 | %lu %lu %lu %lu %lu %ld %ld %ld %ld %d 0 %llu %lu %ld %lu %lu %lu %lu %lu \ |
485 | %lu %lu %lu %lu %lu %lu %lu %lu %d %d %u %u %llu %lu %ld\n", | 495 | %lu %lu %lu %lu %lu %lu %lu %lu %d %d %u %u %llu %lu %ld\n", |
486 | task->pid, | 496 | task_pid_nr_ns(task, ns), |
487 | tcomm, | 497 | tcomm, |
488 | state, | 498 | state, |
489 | ppid, | 499 | ppid, |
diff --git a/fs/proc/base.c b/fs/proc/base.c index 4fe74d1564..39a3d7c969 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -63,16 +63,19 @@ | |||
63 | #include <linux/mm.h> | 63 | #include <linux/mm.h> |
64 | #include <linux/rcupdate.h> | 64 | #include <linux/rcupdate.h> |
65 | #include <linux/kallsyms.h> | 65 | #include <linux/kallsyms.h> |
66 | #include <linux/resource.h> | ||
66 | #include <linux/module.h> | 67 | #include <linux/module.h> |
67 | #include <linux/mount.h> | 68 | #include <linux/mount.h> |
68 | #include <linux/security.h> | 69 | #include <linux/security.h> |
69 | #include <linux/ptrace.h> | 70 | #include <linux/ptrace.h> |
71 | #include <linux/cgroup.h> | ||
70 | #include <linux/cpuset.h> | 72 | #include <linux/cpuset.h> |
71 | #include <linux/audit.h> | 73 | #include <linux/audit.h> |
72 | #include <linux/poll.h> | 74 | #include <linux/poll.h> |
73 | #include <linux/nsproxy.h> | 75 | #include <linux/nsproxy.h> |
74 | #include <linux/oom.h> | 76 | #include <linux/oom.h> |
75 | #include <linux/elf.h> | 77 | #include <linux/elf.h> |
78 | #include <linux/pid_namespace.h> | ||
76 | #include "internal.h" | 79 | #include "internal.h" |
77 | 80 | ||
78 | /* NOTE: | 81 | /* NOTE: |
@@ -301,6 +304,78 @@ static int proc_oom_score(struct task_struct *task, char *buffer) | |||
301 | return sprintf(buffer, "%lu\n", points); | 304 | return sprintf(buffer, "%lu\n", points); |
302 | } | 305 | } |
303 | 306 | ||
307 | struct limit_names { | ||
308 | char *name; | ||
309 | char *unit; | ||
310 | }; | ||
311 | |||
312 | static const struct limit_names lnames[RLIM_NLIMITS] = { | ||
313 | [RLIMIT_CPU] = {"Max cpu time", "ms"}, | ||
314 | [RLIMIT_FSIZE] = {"Max file size", "bytes"}, | ||
315 | [RLIMIT_DATA] = {"Max data size", "bytes"}, | ||
316 | [RLIMIT_STACK] = {"Max stack size", "bytes"}, | ||
317 | [RLIMIT_CORE] = {"Max core file size", "bytes"}, | ||
318 | [RLIMIT_RSS] = {"Max resident set", "bytes"}, | ||
319 | [RLIMIT_NPROC] = {"Max processes", "processes"}, | ||
320 | [RLIMIT_NOFILE] = {"Max open files", "files"}, | ||
321 | [RLIMIT_MEMLOCK] = {"Max locked memory", "bytes"}, | ||
322 | [RLIMIT_AS] = {"Max address space", "bytes"}, | ||
323 | [RLIMIT_LOCKS] = {"Max file locks", "locks"}, | ||
324 | [RLIMIT_SIGPENDING] = {"Max pending signals", "signals"}, | ||
325 | [RLIMIT_MSGQUEUE] = {"Max msgqueue size", "bytes"}, | ||
326 | [RLIMIT_NICE] = {"Max nice priority", NULL}, | ||
327 | [RLIMIT_RTPRIO] = {"Max realtime priority", NULL}, | ||
328 | }; | ||
329 | |||
330 | /* Display limits for a process */ | ||
331 | static int proc_pid_limits(struct task_struct *task, char *buffer) | ||
332 | { | ||
333 | unsigned int i; | ||
334 | int count = 0; | ||
335 | unsigned long flags; | ||
336 | char *bufptr = buffer; | ||
337 | |||
338 | struct rlimit rlim[RLIM_NLIMITS]; | ||
339 | |||
340 | rcu_read_lock(); | ||
341 | if (!lock_task_sighand(task,&flags)) { | ||
342 | rcu_read_unlock(); | ||
343 | return 0; | ||
344 | } | ||
345 | memcpy(rlim, task->signal->rlim, sizeof(struct rlimit) * RLIM_NLIMITS); | ||
346 | unlock_task_sighand(task, &flags); | ||
347 | rcu_read_unlock(); | ||
348 | |||
349 | /* | ||
350 | * print the file header | ||
351 | */ | ||
352 | count += sprintf(&bufptr[count], "%-25s %-20s %-20s %-10s\n", | ||
353 | "Limit", "Soft Limit", "Hard Limit", "Units"); | ||
354 | |||
355 | for (i = 0; i < RLIM_NLIMITS; i++) { | ||
356 | if (rlim[i].rlim_cur == RLIM_INFINITY) | ||
357 | count += sprintf(&bufptr[count], "%-25s %-20s ", | ||
358 | lnames[i].name, "unlimited"); | ||
359 | else | ||
360 | count += sprintf(&bufptr[count], "%-25s %-20lu ", | ||
361 | lnames[i].name, rlim[i].rlim_cur); | ||
362 | |||
363 | if (rlim[i].rlim_max == RLIM_INFINITY) | ||
364 | count += sprintf(&bufptr[count], "%-20s ", "unlimited"); | ||
365 | else | ||
366 | count += sprintf(&bufptr[count], "%-20lu ", | ||
367 | rlim[i].rlim_max); | ||
368 | |||
369 | if (lnames[i].unit) | ||
370 | count += sprintf(&bufptr[count], "%-10s\n", | ||
371 | lnames[i].unit); | ||
372 | else | ||
373 | count += sprintf(&bufptr[count], "\n"); | ||
374 | } | ||
375 | |||
376 | return count; | ||
377 | } | ||
378 | |||
304 | /************************************************************************/ | 379 | /************************************************************************/ |
305 | /* Here the fs part begins */ | 380 | /* Here the fs part begins */ |
306 | /************************************************************************/ | 381 | /************************************************************************/ |
@@ -349,18 +424,21 @@ struct proc_mounts { | |||
349 | static int mounts_open(struct inode *inode, struct file *file) | 424 | static int mounts_open(struct inode *inode, struct file *file) |
350 | { | 425 | { |
351 | struct task_struct *task = get_proc_task(inode); | 426 | struct task_struct *task = get_proc_task(inode); |
427 | struct nsproxy *nsp; | ||
352 | struct mnt_namespace *ns = NULL; | 428 | struct mnt_namespace *ns = NULL; |
353 | struct proc_mounts *p; | 429 | struct proc_mounts *p; |
354 | int ret = -EINVAL; | 430 | int ret = -EINVAL; |
355 | 431 | ||
356 | if (task) { | 432 | if (task) { |
357 | task_lock(task); | 433 | rcu_read_lock(); |
358 | if (task->nsproxy) { | 434 | nsp = task_nsproxy(task); |
359 | ns = task->nsproxy->mnt_ns; | 435 | if (nsp) { |
436 | ns = nsp->mnt_ns; | ||
360 | if (ns) | 437 | if (ns) |
361 | get_mnt_ns(ns); | 438 | get_mnt_ns(ns); |
362 | } | 439 | } |
363 | task_unlock(task); | 440 | rcu_read_unlock(); |
441 | |||
364 | put_task_struct(task); | 442 | put_task_struct(task); |
365 | } | 443 | } |
366 | 444 | ||
@@ -423,16 +501,20 @@ static int mountstats_open(struct inode *inode, struct file *file) | |||
423 | 501 | ||
424 | if (!ret) { | 502 | if (!ret) { |
425 | struct seq_file *m = file->private_data; | 503 | struct seq_file *m = file->private_data; |
504 | struct nsproxy *nsp; | ||
426 | struct mnt_namespace *mnt_ns = NULL; | 505 | struct mnt_namespace *mnt_ns = NULL; |
427 | struct task_struct *task = get_proc_task(inode); | 506 | struct task_struct *task = get_proc_task(inode); |
428 | 507 | ||
429 | if (task) { | 508 | if (task) { |
430 | task_lock(task); | 509 | rcu_read_lock(); |
431 | if (task->nsproxy) | 510 | nsp = task_nsproxy(task); |
432 | mnt_ns = task->nsproxy->mnt_ns; | 511 | if (nsp) { |
433 | if (mnt_ns) | 512 | mnt_ns = nsp->mnt_ns; |
434 | get_mnt_ns(mnt_ns); | 513 | if (mnt_ns) |
435 | task_unlock(task); | 514 | get_mnt_ns(mnt_ns); |
515 | } | ||
516 | rcu_read_unlock(); | ||
517 | |||
436 | put_task_struct(task); | 518 | put_task_struct(task); |
437 | } | 519 | } |
438 | 520 | ||
@@ -1437,7 +1519,7 @@ static int proc_readfd_common(struct file * filp, void * dirent, | |||
1437 | struct dentry *dentry = filp->f_path.dentry; | 1519 | struct dentry *dentry = filp->f_path.dentry; |
1438 | struct inode *inode = dentry->d_inode; | 1520 | struct inode *inode = dentry->d_inode; |
1439 | struct task_struct *p = get_proc_task(inode); | 1521 | struct task_struct *p = get_proc_task(inode); |
1440 | unsigned int fd, tid, ino; | 1522 | unsigned int fd, ino; |
1441 | int retval; | 1523 | int retval; |
1442 | struct files_struct * files; | 1524 | struct files_struct * files; |
1443 | struct fdtable *fdt; | 1525 | struct fdtable *fdt; |
@@ -1446,7 +1528,6 @@ static int proc_readfd_common(struct file * filp, void * dirent, | |||
1446 | if (!p) | 1528 | if (!p) |
1447 | goto out_no_task; | 1529 | goto out_no_task; |
1448 | retval = 0; | 1530 | retval = 0; |
1449 | tid = p->pid; | ||
1450 | 1531 | ||
1451 | fd = filp->f_pos; | 1532 | fd = filp->f_pos; |
1452 | switch (fd) { | 1533 | switch (fd) { |
@@ -1681,7 +1762,6 @@ static int proc_pident_readdir(struct file *filp, | |||
1681 | const struct pid_entry *ents, unsigned int nents) | 1762 | const struct pid_entry *ents, unsigned int nents) |
1682 | { | 1763 | { |
1683 | int i; | 1764 | int i; |
1684 | int pid; | ||
1685 | struct dentry *dentry = filp->f_path.dentry; | 1765 | struct dentry *dentry = filp->f_path.dentry; |
1686 | struct inode *inode = dentry->d_inode; | 1766 | struct inode *inode = dentry->d_inode; |
1687 | struct task_struct *task = get_proc_task(inode); | 1767 | struct task_struct *task = get_proc_task(inode); |
@@ -1694,7 +1774,6 @@ static int proc_pident_readdir(struct file *filp, | |||
1694 | goto out_no_task; | 1774 | goto out_no_task; |
1695 | 1775 | ||
1696 | ret = 0; | 1776 | ret = 0; |
1697 | pid = task->pid; | ||
1698 | i = filp->f_pos; | 1777 | i = filp->f_pos; |
1699 | switch (i) { | 1778 | switch (i) { |
1700 | case 0: | 1779 | case 0: |
@@ -1928,14 +2007,14 @@ static int proc_self_readlink(struct dentry *dentry, char __user *buffer, | |||
1928 | int buflen) | 2007 | int buflen) |
1929 | { | 2008 | { |
1930 | char tmp[PROC_NUMBUF]; | 2009 | char tmp[PROC_NUMBUF]; |
1931 | sprintf(tmp, "%d", current->tgid); | 2010 | sprintf(tmp, "%d", task_tgid_vnr(current)); |
1932 | return vfs_readlink(dentry,buffer,buflen,tmp); | 2011 | return vfs_readlink(dentry,buffer,buflen,tmp); |
1933 | } | 2012 | } |
1934 | 2013 | ||
1935 | static void *proc_self_follow_link(struct dentry *dentry, struct nameidata *nd) | 2014 | static void *proc_self_follow_link(struct dentry *dentry, struct nameidata *nd) |
1936 | { | 2015 | { |
1937 | char tmp[PROC_NUMBUF]; | 2016 | char tmp[PROC_NUMBUF]; |
1938 | sprintf(tmp, "%d", current->tgid); | 2017 | sprintf(tmp, "%d", task_tgid_vnr(current)); |
1939 | return ERR_PTR(vfs_follow_link(nd,tmp)); | 2018 | return ERR_PTR(vfs_follow_link(nd,tmp)); |
1940 | } | 2019 | } |
1941 | 2020 | ||
@@ -2101,6 +2180,7 @@ static const struct pid_entry tgid_base_stuff[] = { | |||
2101 | REG("environ", S_IRUSR, environ), | 2180 | REG("environ", S_IRUSR, environ), |
2102 | INF("auxv", S_IRUSR, pid_auxv), | 2181 | INF("auxv", S_IRUSR, pid_auxv), |
2103 | INF("status", S_IRUGO, pid_status), | 2182 | INF("status", S_IRUGO, pid_status), |
2183 | INF("limits", S_IRUSR, pid_limits), | ||
2104 | #ifdef CONFIG_SCHED_DEBUG | 2184 | #ifdef CONFIG_SCHED_DEBUG |
2105 | REG("sched", S_IRUGO|S_IWUSR, pid_sched), | 2185 | REG("sched", S_IRUGO|S_IWUSR, pid_sched), |
2106 | #endif | 2186 | #endif |
@@ -2130,9 +2210,12 @@ static const struct pid_entry tgid_base_stuff[] = { | |||
2130 | #ifdef CONFIG_SCHEDSTATS | 2210 | #ifdef CONFIG_SCHEDSTATS |
2131 | INF("schedstat", S_IRUGO, pid_schedstat), | 2211 | INF("schedstat", S_IRUGO, pid_schedstat), |
2132 | #endif | 2212 | #endif |
2133 | #ifdef CONFIG_CPUSETS | 2213 | #ifdef CONFIG_PROC_PID_CPUSET |
2134 | REG("cpuset", S_IRUGO, cpuset), | 2214 | REG("cpuset", S_IRUGO, cpuset), |
2135 | #endif | 2215 | #endif |
2216 | #ifdef CONFIG_CGROUPS | ||
2217 | REG("cgroup", S_IRUGO, cgroup), | ||
2218 | #endif | ||
2136 | INF("oom_score", S_IRUGO, oom_score), | 2219 | INF("oom_score", S_IRUGO, oom_score), |
2137 | REG("oom_adj", S_IRUGO|S_IWUSR, oom_adjust), | 2220 | REG("oom_adj", S_IRUGO|S_IWUSR, oom_adjust), |
2138 | #ifdef CONFIG_AUDITSYSCALL | 2221 | #ifdef CONFIG_AUDITSYSCALL |
@@ -2193,27 +2276,27 @@ static const struct inode_operations proc_tgid_base_inode_operations = { | |||
2193 | * that no dcache entries will exist at process exit time it | 2276 | * that no dcache entries will exist at process exit time it |
2194 | * just makes it very unlikely that any will persist. | 2277 | * just makes it very unlikely that any will persist. |
2195 | */ | 2278 | */ |
2196 | void proc_flush_task(struct task_struct *task) | 2279 | static void proc_flush_task_mnt(struct vfsmount *mnt, pid_t pid, pid_t tgid) |
2197 | { | 2280 | { |
2198 | struct dentry *dentry, *leader, *dir; | 2281 | struct dentry *dentry, *leader, *dir; |
2199 | char buf[PROC_NUMBUF]; | 2282 | char buf[PROC_NUMBUF]; |
2200 | struct qstr name; | 2283 | struct qstr name; |
2201 | 2284 | ||
2202 | name.name = buf; | 2285 | name.name = buf; |
2203 | name.len = snprintf(buf, sizeof(buf), "%d", task->pid); | 2286 | name.len = snprintf(buf, sizeof(buf), "%d", pid); |
2204 | dentry = d_hash_and_lookup(proc_mnt->mnt_root, &name); | 2287 | dentry = d_hash_and_lookup(mnt->mnt_root, &name); |
2205 | if (dentry) { | 2288 | if (dentry) { |
2206 | shrink_dcache_parent(dentry); | 2289 | shrink_dcache_parent(dentry); |
2207 | d_drop(dentry); | 2290 | d_drop(dentry); |
2208 | dput(dentry); | 2291 | dput(dentry); |
2209 | } | 2292 | } |
2210 | 2293 | ||
2211 | if (thread_group_leader(task)) | 2294 | if (tgid == 0) |
2212 | goto out; | 2295 | goto out; |
2213 | 2296 | ||
2214 | name.name = buf; | 2297 | name.name = buf; |
2215 | name.len = snprintf(buf, sizeof(buf), "%d", task->tgid); | 2298 | name.len = snprintf(buf, sizeof(buf), "%d", tgid); |
2216 | leader = d_hash_and_lookup(proc_mnt->mnt_root, &name); | 2299 | leader = d_hash_and_lookup(mnt->mnt_root, &name); |
2217 | if (!leader) | 2300 | if (!leader) |
2218 | goto out; | 2301 | goto out; |
2219 | 2302 | ||
@@ -2224,7 +2307,7 @@ void proc_flush_task(struct task_struct *task) | |||
2224 | goto out_put_leader; | 2307 | goto out_put_leader; |
2225 | 2308 | ||
2226 | name.name = buf; | 2309 | name.name = buf; |
2227 | name.len = snprintf(buf, sizeof(buf), "%d", task->pid); | 2310 | name.len = snprintf(buf, sizeof(buf), "%d", pid); |
2228 | dentry = d_hash_and_lookup(dir, &name); | 2311 | dentry = d_hash_and_lookup(dir, &name); |
2229 | if (dentry) { | 2312 | if (dentry) { |
2230 | shrink_dcache_parent(dentry); | 2313 | shrink_dcache_parent(dentry); |
@@ -2239,6 +2322,36 @@ out: | |||
2239 | return; | 2322 | return; |
2240 | } | 2323 | } |
2241 | 2324 | ||
2325 | /* | ||
2326 | * when flushing dentries from proc one need to flush them from global | ||
2327 | * proc (proc_mnt) and from all the namespaces' procs this task was seen | ||
2328 | * in. this call is supposed to make all this job. | ||
2329 | */ | ||
2330 | |||
2331 | void proc_flush_task(struct task_struct *task) | ||
2332 | { | ||
2333 | int i, leader; | ||
2334 | struct pid *pid, *tgid; | ||
2335 | struct upid *upid; | ||
2336 | |||
2337 | leader = thread_group_leader(task); | ||
2338 | proc_flush_task_mnt(proc_mnt, task->pid, leader ? task->tgid : 0); | ||
2339 | pid = task_pid(task); | ||
2340 | if (pid->level == 0) | ||
2341 | return; | ||
2342 | |||
2343 | tgid = task_tgid(task); | ||
2344 | for (i = 1; i <= pid->level; i++) { | ||
2345 | upid = &pid->numbers[i]; | ||
2346 | proc_flush_task_mnt(upid->ns->proc_mnt, upid->nr, | ||
2347 | leader ? 0 : tgid->numbers[i].nr); | ||
2348 | } | ||
2349 | |||
2350 | upid = &pid->numbers[pid->level]; | ||
2351 | if (upid->nr == 1) | ||
2352 | pid_ns_release_proc(upid->ns); | ||
2353 | } | ||
2354 | |||
2242 | static struct dentry *proc_pid_instantiate(struct inode *dir, | 2355 | static struct dentry *proc_pid_instantiate(struct inode *dir, |
2243 | struct dentry * dentry, | 2356 | struct dentry * dentry, |
2244 | struct task_struct *task, const void *ptr) | 2357 | struct task_struct *task, const void *ptr) |
@@ -2274,6 +2387,7 @@ struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct | |||
2274 | struct dentry *result = ERR_PTR(-ENOENT); | 2387 | struct dentry *result = ERR_PTR(-ENOENT); |
2275 | struct task_struct *task; | 2388 | struct task_struct *task; |
2276 | unsigned tgid; | 2389 | unsigned tgid; |
2390 | struct pid_namespace *ns; | ||
2277 | 2391 | ||
2278 | result = proc_base_lookup(dir, dentry); | 2392 | result = proc_base_lookup(dir, dentry); |
2279 | if (!IS_ERR(result) || PTR_ERR(result) != -ENOENT) | 2393 | if (!IS_ERR(result) || PTR_ERR(result) != -ENOENT) |
@@ -2283,8 +2397,9 @@ struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct | |||
2283 | if (tgid == ~0U) | 2397 | if (tgid == ~0U) |
2284 | goto out; | 2398 | goto out; |
2285 | 2399 | ||
2400 | ns = dentry->d_sb->s_fs_info; | ||
2286 | rcu_read_lock(); | 2401 | rcu_read_lock(); |
2287 | task = find_task_by_pid(tgid); | 2402 | task = find_task_by_pid_ns(tgid, ns); |
2288 | if (task) | 2403 | if (task) |
2289 | get_task_struct(task); | 2404 | get_task_struct(task); |
2290 | rcu_read_unlock(); | 2405 | rcu_read_unlock(); |
@@ -2301,7 +2416,8 @@ out: | |||
2301 | * Find the first task with tgid >= tgid | 2416 | * Find the first task with tgid >= tgid |
2302 | * | 2417 | * |
2303 | */ | 2418 | */ |
2304 | static struct task_struct *next_tgid(unsigned int tgid) | 2419 | static struct task_struct *next_tgid(unsigned int tgid, |
2420 | struct pid_namespace *ns) | ||
2305 | { | 2421 | { |
2306 | struct task_struct *task; | 2422 | struct task_struct *task; |
2307 | struct pid *pid; | 2423 | struct pid *pid; |
@@ -2309,9 +2425,9 @@ static struct task_struct *next_tgid(unsigned int tgid) | |||
2309 | rcu_read_lock(); | 2425 | rcu_read_lock(); |
2310 | retry: | 2426 | retry: |
2311 | task = NULL; | 2427 | task = NULL; |
2312 | pid = find_ge_pid(tgid); | 2428 | pid = find_ge_pid(tgid, ns); |
2313 | if (pid) { | 2429 | if (pid) { |
2314 | tgid = pid->nr + 1; | 2430 | tgid = pid_nr_ns(pid, ns) + 1; |
2315 | task = pid_task(pid, PIDTYPE_PID); | 2431 | task = pid_task(pid, PIDTYPE_PID); |
2316 | /* What we to know is if the pid we have find is the | 2432 | /* What we to know is if the pid we have find is the |
2317 | * pid of a thread_group_leader. Testing for task | 2433 | * pid of a thread_group_leader. Testing for task |
@@ -2351,6 +2467,7 @@ int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir) | |||
2351 | struct task_struct *reaper = get_proc_task(filp->f_path.dentry->d_inode); | 2467 | struct task_struct *reaper = get_proc_task(filp->f_path.dentry->d_inode); |
2352 | struct task_struct *task; | 2468 | struct task_struct *task; |
2353 | int tgid; | 2469 | int tgid; |
2470 | struct pid_namespace *ns; | ||
2354 | 2471 | ||
2355 | if (!reaper) | 2472 | if (!reaper) |
2356 | goto out_no_task; | 2473 | goto out_no_task; |
@@ -2361,11 +2478,12 @@ int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir) | |||
2361 | goto out; | 2478 | goto out; |
2362 | } | 2479 | } |
2363 | 2480 | ||
2481 | ns = filp->f_dentry->d_sb->s_fs_info; | ||
2364 | tgid = filp->f_pos - TGID_OFFSET; | 2482 | tgid = filp->f_pos - TGID_OFFSET; |
2365 | for (task = next_tgid(tgid); | 2483 | for (task = next_tgid(tgid, ns); |
2366 | task; | 2484 | task; |
2367 | put_task_struct(task), task = next_tgid(tgid + 1)) { | 2485 | put_task_struct(task), task = next_tgid(tgid + 1, ns)) { |
2368 | tgid = task->pid; | 2486 | tgid = task_pid_nr_ns(task, ns); |
2369 | filp->f_pos = tgid + TGID_OFFSET; | 2487 | filp->f_pos = tgid + TGID_OFFSET; |
2370 | if (proc_pid_fill_cache(filp, dirent, filldir, task, tgid) < 0) { | 2488 | if (proc_pid_fill_cache(filp, dirent, filldir, task, tgid) < 0) { |
2371 | put_task_struct(task); | 2489 | put_task_struct(task); |
@@ -2388,6 +2506,7 @@ static const struct pid_entry tid_base_stuff[] = { | |||
2388 | REG("environ", S_IRUSR, environ), | 2506 | REG("environ", S_IRUSR, environ), |
2389 | INF("auxv", S_IRUSR, pid_auxv), | 2507 | INF("auxv", S_IRUSR, pid_auxv), |
2390 | INF("status", S_IRUGO, pid_status), | 2508 | INF("status", S_IRUGO, pid_status), |
2509 | INF("limits", S_IRUSR, pid_limits), | ||
2391 | #ifdef CONFIG_SCHED_DEBUG | 2510 | #ifdef CONFIG_SCHED_DEBUG |
2392 | REG("sched", S_IRUGO|S_IWUSR, pid_sched), | 2511 | REG("sched", S_IRUGO|S_IWUSR, pid_sched), |
2393 | #endif | 2512 | #endif |
@@ -2416,9 +2535,12 @@ static const struct pid_entry tid_base_stuff[] = { | |||
2416 | #ifdef CONFIG_SCHEDSTATS | 2535 | #ifdef CONFIG_SCHEDSTATS |
2417 | INF("schedstat", S_IRUGO, pid_schedstat), | 2536 | INF("schedstat", S_IRUGO, pid_schedstat), |
2418 | #endif | 2537 | #endif |
2419 | #ifdef CONFIG_CPUSETS | 2538 | #ifdef CONFIG_PROC_PID_CPUSET |
2420 | REG("cpuset", S_IRUGO, cpuset), | 2539 | REG("cpuset", S_IRUGO, cpuset), |
2421 | #endif | 2540 | #endif |
2541 | #ifdef CONFIG_CGROUPS | ||
2542 | REG("cgroup", S_IRUGO, cgroup), | ||
2543 | #endif | ||
2422 | INF("oom_score", S_IRUGO, oom_score), | 2544 | INF("oom_score", S_IRUGO, oom_score), |
2423 | REG("oom_adj", S_IRUGO|S_IWUSR, oom_adjust), | 2545 | REG("oom_adj", S_IRUGO|S_IWUSR, oom_adjust), |
2424 | #ifdef CONFIG_AUDITSYSCALL | 2546 | #ifdef CONFIG_AUDITSYSCALL |
@@ -2486,6 +2608,7 @@ static struct dentry *proc_task_lookup(struct inode *dir, struct dentry * dentry | |||
2486 | struct task_struct *task; | 2608 | struct task_struct *task; |
2487 | struct task_struct *leader = get_proc_task(dir); | 2609 | struct task_struct *leader = get_proc_task(dir); |
2488 | unsigned tid; | 2610 | unsigned tid; |
2611 | struct pid_namespace *ns; | ||
2489 | 2612 | ||
2490 | if (!leader) | 2613 | if (!leader) |
2491 | goto out_no_task; | 2614 | goto out_no_task; |
@@ -2494,14 +2617,15 @@ static struct dentry *proc_task_lookup(struct inode *dir, struct dentry * dentry | |||
2494 | if (tid == ~0U) | 2617 | if (tid == ~0U) |
2495 | goto out; | 2618 | goto out; |
2496 | 2619 | ||
2620 | ns = dentry->d_sb->s_fs_info; | ||
2497 | rcu_read_lock(); | 2621 | rcu_read_lock(); |
2498 | task = find_task_by_pid(tid); | 2622 | task = find_task_by_pid_ns(tid, ns); |
2499 | if (task) | 2623 | if (task) |
2500 | get_task_struct(task); | 2624 | get_task_struct(task); |
2501 | rcu_read_unlock(); | 2625 | rcu_read_unlock(); |
2502 | if (!task) | 2626 | if (!task) |
2503 | goto out; | 2627 | goto out; |
2504 | if (leader->tgid != task->tgid) | 2628 | if (!same_thread_group(leader, task)) |
2505 | goto out_drop_task; | 2629 | goto out_drop_task; |
2506 | 2630 | ||
2507 | result = proc_task_instantiate(dir, dentry, task, NULL); | 2631 | result = proc_task_instantiate(dir, dentry, task, NULL); |
@@ -2526,14 +2650,14 @@ out_no_task: | |||
2526 | * threads past it. | 2650 | * threads past it. |
2527 | */ | 2651 | */ |
2528 | static struct task_struct *first_tid(struct task_struct *leader, | 2652 | static struct task_struct *first_tid(struct task_struct *leader, |
2529 | int tid, int nr) | 2653 | int tid, int nr, struct pid_namespace *ns) |
2530 | { | 2654 | { |
2531 | struct task_struct *pos; | 2655 | struct task_struct *pos; |
2532 | 2656 | ||
2533 | rcu_read_lock(); | 2657 | rcu_read_lock(); |
2534 | /* Attempt to start with the pid of a thread */ | 2658 | /* Attempt to start with the pid of a thread */ |
2535 | if (tid && (nr > 0)) { | 2659 | if (tid && (nr > 0)) { |
2536 | pos = find_task_by_pid(tid); | 2660 | pos = find_task_by_pid_ns(tid, ns); |
2537 | if (pos && (pos->group_leader == leader)) | 2661 | if (pos && (pos->group_leader == leader)) |
2538 | goto found; | 2662 | goto found; |
2539 | } | 2663 | } |
@@ -2602,6 +2726,7 @@ static int proc_task_readdir(struct file * filp, void * dirent, filldir_t filldi | |||
2602 | ino_t ino; | 2726 | ino_t ino; |
2603 | int tid; | 2727 | int tid; |
2604 | unsigned long pos = filp->f_pos; /* avoiding "long long" filp->f_pos */ | 2728 | unsigned long pos = filp->f_pos; /* avoiding "long long" filp->f_pos */ |
2729 | struct pid_namespace *ns; | ||
2605 | 2730 | ||
2606 | task = get_proc_task(inode); | 2731 | task = get_proc_task(inode); |
2607 | if (!task) | 2732 | if (!task) |
@@ -2635,12 +2760,13 @@ static int proc_task_readdir(struct file * filp, void * dirent, filldir_t filldi | |||
2635 | /* f_version caches the tgid value that the last readdir call couldn't | 2760 | /* f_version caches the tgid value that the last readdir call couldn't |
2636 | * return. lseek aka telldir automagically resets f_version to 0. | 2761 | * return. lseek aka telldir automagically resets f_version to 0. |
2637 | */ | 2762 | */ |
2763 | ns = filp->f_dentry->d_sb->s_fs_info; | ||
2638 | tid = (int)filp->f_version; | 2764 | tid = (int)filp->f_version; |
2639 | filp->f_version = 0; | 2765 | filp->f_version = 0; |
2640 | for (task = first_tid(leader, tid, pos - 2); | 2766 | for (task = first_tid(leader, tid, pos - 2, ns); |
2641 | task; | 2767 | task; |
2642 | task = next_tid(task), pos++) { | 2768 | task = next_tid(task), pos++) { |
2643 | tid = task->pid; | 2769 | tid = task_pid_nr_ns(task, ns); |
2644 | if (proc_task_fill_cache(filp, dirent, filldir, task, tid) < 0) { | 2770 | if (proc_task_fill_cache(filp, dirent, filldir, task, tid) < 0) { |
2645 | /* returning this tgid failed, save it as the first | 2771 | /* returning this tgid failed, save it as the first |
2646 | * pid for the next readir call */ | 2772 | * pid for the next readir call */ |
diff --git a/fs/proc/inode.c b/fs/proc/inode.c index 99ca00485f..abe6a3f043 100644 --- a/fs/proc/inode.c +++ b/fs/proc/inode.c | |||
@@ -448,7 +448,7 @@ out_mod: | |||
448 | return NULL; | 448 | return NULL; |
449 | } | 449 | } |
450 | 450 | ||
451 | int proc_fill_super(struct super_block *s, void *data, int silent) | 451 | int proc_fill_super(struct super_block *s) |
452 | { | 452 | { |
453 | struct inode * root_inode; | 453 | struct inode * root_inode; |
454 | 454 | ||
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c index d6dc72c78b..e0d064e976 100644 --- a/fs/proc/proc_misc.c +++ b/fs/proc/proc_misc.c | |||
@@ -91,7 +91,8 @@ static int loadavg_read_proc(char *page, char **start, off_t off, | |||
91 | LOAD_INT(a), LOAD_FRAC(a), | 91 | LOAD_INT(a), LOAD_FRAC(a), |
92 | LOAD_INT(b), LOAD_FRAC(b), | 92 | LOAD_INT(b), LOAD_FRAC(b), |
93 | LOAD_INT(c), LOAD_FRAC(c), | 93 | LOAD_INT(c), LOAD_FRAC(c), |
94 | nr_running(), nr_threads, current->nsproxy->pid_ns->last_pid); | 94 | nr_running(), nr_threads, |
95 | task_active_pid_ns(current)->last_pid); | ||
95 | return proc_calc_metrics(page, start, off, count, eof, len); | 96 | return proc_calc_metrics(page, start, off, count, eof, len); |
96 | } | 97 | } |
97 | 98 | ||
diff --git a/fs/proc/root.c b/fs/proc/root.c index cf3046638b..ec9cb3b6c9 100644 --- a/fs/proc/root.c +++ b/fs/proc/root.c | |||
@@ -18,32 +18,90 @@ | |||
18 | #include <linux/bitops.h> | 18 | #include <linux/bitops.h> |
19 | #include <linux/smp_lock.h> | 19 | #include <linux/smp_lock.h> |
20 | #include <linux/mount.h> | 20 | #include <linux/mount.h> |
21 | #include <linux/pid_namespace.h> | ||
21 | 22 | ||
22 | #include "internal.h" | 23 | #include "internal.h" |
23 | 24 | ||
24 | struct proc_dir_entry *proc_bus, *proc_root_fs, *proc_root_driver; | 25 | struct proc_dir_entry *proc_bus, *proc_root_fs, *proc_root_driver; |
25 | 26 | ||
27 | static int proc_test_super(struct super_block *sb, void *data) | ||
28 | { | ||
29 | return sb->s_fs_info == data; | ||
30 | } | ||
31 | |||
32 | static int proc_set_super(struct super_block *sb, void *data) | ||
33 | { | ||
34 | struct pid_namespace *ns; | ||
35 | |||
36 | ns = (struct pid_namespace *)data; | ||
37 | sb->s_fs_info = get_pid_ns(ns); | ||
38 | return set_anon_super(sb, NULL); | ||
39 | } | ||
40 | |||
26 | static int proc_get_sb(struct file_system_type *fs_type, | 41 | static int proc_get_sb(struct file_system_type *fs_type, |
27 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) | 42 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
28 | { | 43 | { |
44 | int err; | ||
45 | struct super_block *sb; | ||
46 | struct pid_namespace *ns; | ||
47 | struct proc_inode *ei; | ||
48 | |||
29 | if (proc_mnt) { | 49 | if (proc_mnt) { |
30 | /* Seed the root directory with a pid so it doesn't need | 50 | /* Seed the root directory with a pid so it doesn't need |
31 | * to be special in base.c. I would do this earlier but | 51 | * to be special in base.c. I would do this earlier but |
32 | * the only task alive when /proc is mounted the first time | 52 | * the only task alive when /proc is mounted the first time |
33 | * is the init_task and it doesn't have any pids. | 53 | * is the init_task and it doesn't have any pids. |
34 | */ | 54 | */ |
35 | struct proc_inode *ei; | ||
36 | ei = PROC_I(proc_mnt->mnt_sb->s_root->d_inode); | 55 | ei = PROC_I(proc_mnt->mnt_sb->s_root->d_inode); |
37 | if (!ei->pid) | 56 | if (!ei->pid) |
38 | ei->pid = find_get_pid(1); | 57 | ei->pid = find_get_pid(1); |
39 | } | 58 | } |
40 | return get_sb_single(fs_type, flags, data, proc_fill_super, mnt); | 59 | |
60 | if (flags & MS_KERNMOUNT) | ||
61 | ns = (struct pid_namespace *)data; | ||
62 | else | ||
63 | ns = current->nsproxy->pid_ns; | ||
64 | |||
65 | sb = sget(fs_type, proc_test_super, proc_set_super, ns); | ||
66 | if (IS_ERR(sb)) | ||
67 | return PTR_ERR(sb); | ||
68 | |||
69 | if (!sb->s_root) { | ||
70 | sb->s_flags = flags; | ||
71 | err = proc_fill_super(sb); | ||
72 | if (err) { | ||
73 | up_write(&sb->s_umount); | ||
74 | deactivate_super(sb); | ||
75 | return err; | ||
76 | } | ||
77 | |||
78 | ei = PROC_I(sb->s_root->d_inode); | ||
79 | if (!ei->pid) { | ||
80 | rcu_read_lock(); | ||
81 | ei->pid = get_pid(find_pid_ns(1, ns)); | ||
82 | rcu_read_unlock(); | ||
83 | } | ||
84 | |||
85 | sb->s_flags |= MS_ACTIVE; | ||
86 | ns->proc_mnt = mnt; | ||
87 | } | ||
88 | |||
89 | return simple_set_mnt(mnt, sb); | ||
90 | } | ||
91 | |||
92 | static void proc_kill_sb(struct super_block *sb) | ||
93 | { | ||
94 | struct pid_namespace *ns; | ||
95 | |||
96 | ns = (struct pid_namespace *)sb->s_fs_info; | ||
97 | kill_anon_super(sb); | ||
98 | put_pid_ns(ns); | ||
41 | } | 99 | } |
42 | 100 | ||
43 | static struct file_system_type proc_fs_type = { | 101 | static struct file_system_type proc_fs_type = { |
44 | .name = "proc", | 102 | .name = "proc", |
45 | .get_sb = proc_get_sb, | 103 | .get_sb = proc_get_sb, |
46 | .kill_sb = kill_anon_super, | 104 | .kill_sb = proc_kill_sb, |
47 | }; | 105 | }; |
48 | 106 | ||
49 | void __init proc_root_init(void) | 107 | void __init proc_root_init(void) |
@@ -54,12 +112,13 @@ void __init proc_root_init(void) | |||
54 | err = register_filesystem(&proc_fs_type); | 112 | err = register_filesystem(&proc_fs_type); |
55 | if (err) | 113 | if (err) |
56 | return; | 114 | return; |
57 | proc_mnt = kern_mount(&proc_fs_type); | 115 | proc_mnt = kern_mount_data(&proc_fs_type, &init_pid_ns); |
58 | err = PTR_ERR(proc_mnt); | 116 | err = PTR_ERR(proc_mnt); |
59 | if (IS_ERR(proc_mnt)) { | 117 | if (IS_ERR(proc_mnt)) { |
60 | unregister_filesystem(&proc_fs_type); | 118 | unregister_filesystem(&proc_fs_type); |
61 | return; | 119 | return; |
62 | } | 120 | } |
121 | |||
63 | proc_misc_init(); | 122 | proc_misc_init(); |
64 | 123 | ||
65 | proc_net_init(); | 124 | proc_net_init(); |
@@ -153,6 +212,22 @@ struct proc_dir_entry proc_root = { | |||
153 | .parent = &proc_root, | 212 | .parent = &proc_root, |
154 | }; | 213 | }; |
155 | 214 | ||
215 | int pid_ns_prepare_proc(struct pid_namespace *ns) | ||
216 | { | ||
217 | struct vfsmount *mnt; | ||
218 | |||
219 | mnt = kern_mount_data(&proc_fs_type, ns); | ||
220 | if (IS_ERR(mnt)) | ||
221 | return PTR_ERR(mnt); | ||
222 | |||
223 | return 0; | ||
224 | } | ||
225 | |||
226 | void pid_ns_release_proc(struct pid_namespace *ns) | ||
227 | { | ||
228 | mntput(ns->proc_mnt); | ||
229 | } | ||
230 | |||
156 | EXPORT_SYMBOL(proc_symlink); | 231 | EXPORT_SYMBOL(proc_symlink); |
157 | EXPORT_SYMBOL(proc_mkdir); | 232 | EXPORT_SYMBOL(proc_mkdir); |
158 | EXPORT_SYMBOL(create_proc_entry); | 233 | EXPORT_SYMBOL(create_proc_entry); |
diff --git a/fs/reiserfs/bitmap.c b/fs/reiserfs/bitmap.c index 2a5dd34649..16b331dd99 100644 --- a/fs/reiserfs/bitmap.c +++ b/fs/reiserfs/bitmap.c | |||
@@ -47,7 +47,9 @@ | |||
47 | test_bit(_ALLOC_ ## optname , &SB_ALLOC_OPTS(s)) | 47 | test_bit(_ALLOC_ ## optname , &SB_ALLOC_OPTS(s)) |
48 | 48 | ||
49 | static inline void get_bit_address(struct super_block *s, | 49 | static inline void get_bit_address(struct super_block *s, |
50 | b_blocknr_t block, int *bmap_nr, int *offset) | 50 | b_blocknr_t block, |
51 | unsigned int *bmap_nr, | ||
52 | unsigned int *offset) | ||
51 | { | 53 | { |
52 | /* It is in the bitmap block number equal to the block | 54 | /* It is in the bitmap block number equal to the block |
53 | * number divided by the number of bits in a block. */ | 55 | * number divided by the number of bits in a block. */ |
@@ -56,10 +58,10 @@ static inline void get_bit_address(struct super_block *s, | |||
56 | *offset = block & ((s->s_blocksize << 3) - 1); | 58 | *offset = block & ((s->s_blocksize << 3) - 1); |
57 | } | 59 | } |
58 | 60 | ||
59 | #ifdef CONFIG_REISERFS_CHECK | ||
60 | int is_reusable(struct super_block *s, b_blocknr_t block, int bit_value) | 61 | int is_reusable(struct super_block *s, b_blocknr_t block, int bit_value) |
61 | { | 62 | { |
62 | int bmap, offset; | 63 | unsigned int bmap, offset; |
64 | unsigned int bmap_count = reiserfs_bmap_count(s); | ||
63 | 65 | ||
64 | if (block == 0 || block >= SB_BLOCK_COUNT(s)) { | 66 | if (block == 0 || block >= SB_BLOCK_COUNT(s)) { |
65 | reiserfs_warning(s, | 67 | reiserfs_warning(s, |
@@ -75,25 +77,26 @@ int is_reusable(struct super_block *s, b_blocknr_t block, int bit_value) | |||
75 | if (unlikely(test_bit(REISERFS_OLD_FORMAT, | 77 | if (unlikely(test_bit(REISERFS_OLD_FORMAT, |
76 | &(REISERFS_SB(s)->s_properties)))) { | 78 | &(REISERFS_SB(s)->s_properties)))) { |
77 | b_blocknr_t bmap1 = REISERFS_SB(s)->s_sbh->b_blocknr + 1; | 79 | b_blocknr_t bmap1 = REISERFS_SB(s)->s_sbh->b_blocknr + 1; |
78 | if (block >= bmap1 && block <= bmap1 + SB_BMAP_NR(s)) { | 80 | if (block >= bmap1 && |
81 | block <= bmap1 + bmap_count) { | ||
79 | reiserfs_warning(s, "vs: 4019: is_reusable: " | 82 | reiserfs_warning(s, "vs: 4019: is_reusable: " |
80 | "bitmap block %lu(%u) can't be freed or reused", | 83 | "bitmap block %lu(%u) can't be freed or reused", |
81 | block, SB_BMAP_NR(s)); | 84 | block, bmap_count); |
82 | return 0; | 85 | return 0; |
83 | } | 86 | } |
84 | } else { | 87 | } else { |
85 | if (offset == 0) { | 88 | if (offset == 0) { |
86 | reiserfs_warning(s, "vs: 4020: is_reusable: " | 89 | reiserfs_warning(s, "vs: 4020: is_reusable: " |
87 | "bitmap block %lu(%u) can't be freed or reused", | 90 | "bitmap block %lu(%u) can't be freed or reused", |
88 | block, SB_BMAP_NR(s)); | 91 | block, bmap_count); |
89 | return 0; | 92 | return 0; |
90 | } | 93 | } |
91 | } | 94 | } |
92 | 95 | ||
93 | if (bmap >= SB_BMAP_NR(s)) { | 96 | if (bmap >= bmap_count) { |
94 | reiserfs_warning(s, | 97 | reiserfs_warning(s, |
95 | "vs-4030: is_reusable: there is no so many bitmap blocks: " | 98 | "vs-4030: is_reusable: there is no so many bitmap blocks: " |
96 | "block=%lu, bitmap_nr=%d", block, bmap); | 99 | "block=%lu, bitmap_nr=%u", block, bmap); |
97 | return 0; | 100 | return 0; |
98 | } | 101 | } |
99 | 102 | ||
@@ -106,12 +109,11 @@ int is_reusable(struct super_block *s, b_blocknr_t block, int bit_value) | |||
106 | 109 | ||
107 | return 1; | 110 | return 1; |
108 | } | 111 | } |
109 | #endif /* CONFIG_REISERFS_CHECK */ | ||
110 | 112 | ||
111 | /* searches in journal structures for a given block number (bmap, off). If block | 113 | /* searches in journal structures for a given block number (bmap, off). If block |
112 | is found in reiserfs journal it suggests next free block candidate to test. */ | 114 | is found in reiserfs journal it suggests next free block candidate to test. */ |
113 | static inline int is_block_in_journal(struct super_block *s, int bmap, int | 115 | static inline int is_block_in_journal(struct super_block *s, unsigned int bmap, |
114 | off, int *next) | 116 | int off, int *next) |
115 | { | 117 | { |
116 | b_blocknr_t tmp; | 118 | b_blocknr_t tmp; |
117 | 119 | ||
@@ -132,8 +134,8 @@ static inline int is_block_in_journal(struct super_block *s, int bmap, int | |||
132 | /* it searches for a window of zero bits with given minimum and maximum lengths in one bitmap | 134 | /* it searches for a window of zero bits with given minimum and maximum lengths in one bitmap |
133 | * block; */ | 135 | * block; */ |
134 | static int scan_bitmap_block(struct reiserfs_transaction_handle *th, | 136 | static int scan_bitmap_block(struct reiserfs_transaction_handle *th, |
135 | int bmap_n, int *beg, int boundary, int min, | 137 | unsigned int bmap_n, int *beg, int boundary, |
136 | int max, int unfm) | 138 | int min, int max, int unfm) |
137 | { | 139 | { |
138 | struct super_block *s = th->t_super; | 140 | struct super_block *s = th->t_super; |
139 | struct reiserfs_bitmap_info *bi = &SB_AP_BITMAP(s)[bmap_n]; | 141 | struct reiserfs_bitmap_info *bi = &SB_AP_BITMAP(s)[bmap_n]; |
@@ -143,8 +145,8 @@ static int scan_bitmap_block(struct reiserfs_transaction_handle *th, | |||
143 | 145 | ||
144 | BUG_ON(!th->t_trans_id); | 146 | BUG_ON(!th->t_trans_id); |
145 | 147 | ||
146 | RFALSE(bmap_n >= SB_BMAP_NR(s), "Bitmap %d is out of range (0..%d)", | 148 | RFALSE(bmap_n >= reiserfs_bmap_count(s), "Bitmap %u is out of " |
147 | bmap_n, SB_BMAP_NR(s) - 1); | 149 | "range (0..%u)", bmap_n, reiserfs_bmap_count(s) - 1); |
148 | PROC_INFO_INC(s, scan_bitmap.bmap); | 150 | PROC_INFO_INC(s, scan_bitmap.bmap); |
149 | /* this is unclear and lacks comments, explain how journal bitmaps | 151 | /* this is unclear and lacks comments, explain how journal bitmaps |
150 | work here for the reader. Convey a sense of the design here. What | 152 | work here for the reader. Convey a sense of the design here. What |
@@ -249,12 +251,12 @@ static int bmap_hash_id(struct super_block *s, u32 id) | |||
249 | } else { | 251 | } else { |
250 | hash_in = (char *)(&id); | 252 | hash_in = (char *)(&id); |
251 | hash = keyed_hash(hash_in, 4); | 253 | hash = keyed_hash(hash_in, 4); |
252 | bm = hash % SB_BMAP_NR(s); | 254 | bm = hash % reiserfs_bmap_count(s); |
253 | if (!bm) | 255 | if (!bm) |
254 | bm = 1; | 256 | bm = 1; |
255 | } | 257 | } |
256 | /* this can only be true when SB_BMAP_NR = 1 */ | 258 | /* this can only be true when SB_BMAP_NR = 1 */ |
257 | if (bm >= SB_BMAP_NR(s)) | 259 | if (bm >= reiserfs_bmap_count(s)) |
258 | bm = 0; | 260 | bm = 0; |
259 | return bm; | 261 | return bm; |
260 | } | 262 | } |
@@ -273,7 +275,7 @@ static inline int block_group_used(struct super_block *s, u32 id) | |||
273 | * to make a better decision. This favors long-term performace gain | 275 | * to make a better decision. This favors long-term performace gain |
274 | * with a better on-disk layout vs. a short term gain of skipping the | 276 | * with a better on-disk layout vs. a short term gain of skipping the |
275 | * read and potentially having a bad placement. */ | 277 | * read and potentially having a bad placement. */ |
276 | if (info->first_zero_hint == 0) { | 278 | if (info->free_count == UINT_MAX) { |
277 | struct buffer_head *bh = reiserfs_read_bitmap_block(s, bm); | 279 | struct buffer_head *bh = reiserfs_read_bitmap_block(s, bm); |
278 | brelse(bh); | 280 | brelse(bh); |
279 | } | 281 | } |
@@ -309,16 +311,16 @@ __le32 reiserfs_choose_packing(struct inode * dir) | |||
309 | * bitmap and place new blocks there. Returns number of allocated blocks. */ | 311 | * bitmap and place new blocks there. Returns number of allocated blocks. */ |
310 | static int scan_bitmap(struct reiserfs_transaction_handle *th, | 312 | static int scan_bitmap(struct reiserfs_transaction_handle *th, |
311 | b_blocknr_t * start, b_blocknr_t finish, | 313 | b_blocknr_t * start, b_blocknr_t finish, |
312 | int min, int max, int unfm, unsigned long file_block) | 314 | int min, int max, int unfm, sector_t file_block) |
313 | { | 315 | { |
314 | int nr_allocated = 0; | 316 | int nr_allocated = 0; |
315 | struct super_block *s = th->t_super; | 317 | struct super_block *s = th->t_super; |
316 | /* find every bm and bmap and bmap_nr in this file, and change them all to bitmap_blocknr | 318 | /* find every bm and bmap and bmap_nr in this file, and change them all to bitmap_blocknr |
317 | * - Hans, it is not a block number - Zam. */ | 319 | * - Hans, it is not a block number - Zam. */ |
318 | 320 | ||
319 | int bm, off; | 321 | unsigned int bm, off; |
320 | int end_bm, end_off; | 322 | unsigned int end_bm, end_off; |
321 | int off_max = s->s_blocksize << 3; | 323 | unsigned int off_max = s->s_blocksize << 3; |
322 | 324 | ||
323 | BUG_ON(!th->t_trans_id); | 325 | BUG_ON(!th->t_trans_id); |
324 | 326 | ||
@@ -328,10 +330,10 @@ static int scan_bitmap(struct reiserfs_transaction_handle *th, | |||
328 | 330 | ||
329 | get_bit_address(s, *start, &bm, &off); | 331 | get_bit_address(s, *start, &bm, &off); |
330 | get_bit_address(s, finish, &end_bm, &end_off); | 332 | get_bit_address(s, finish, &end_bm, &end_off); |
331 | if (bm > SB_BMAP_NR(s)) | 333 | if (bm > reiserfs_bmap_count(s)) |
332 | return 0; | 334 | return 0; |
333 | if (end_bm > SB_BMAP_NR(s)) | 335 | if (end_bm > reiserfs_bmap_count(s)) |
334 | end_bm = SB_BMAP_NR(s); | 336 | end_bm = reiserfs_bmap_count(s); |
335 | 337 | ||
336 | /* When the bitmap is more than 10% free, anyone can allocate. | 338 | /* When the bitmap is more than 10% free, anyone can allocate. |
337 | * When it's less than 10% free, only files that already use the | 339 | * When it's less than 10% free, only files that already use the |
@@ -385,7 +387,7 @@ static void _reiserfs_free_block(struct reiserfs_transaction_handle *th, | |||
385 | struct reiserfs_super_block *rs; | 387 | struct reiserfs_super_block *rs; |
386 | struct buffer_head *sbh, *bmbh; | 388 | struct buffer_head *sbh, *bmbh; |
387 | struct reiserfs_bitmap_info *apbi; | 389 | struct reiserfs_bitmap_info *apbi; |
388 | int nr, offset; | 390 | unsigned int nr, offset; |
389 | 391 | ||
390 | BUG_ON(!th->t_trans_id); | 392 | BUG_ON(!th->t_trans_id); |
391 | 393 | ||
@@ -397,10 +399,12 @@ static void _reiserfs_free_block(struct reiserfs_transaction_handle *th, | |||
397 | 399 | ||
398 | get_bit_address(s, block, &nr, &offset); | 400 | get_bit_address(s, block, &nr, &offset); |
399 | 401 | ||
400 | if (nr >= sb_bmap_nr(rs)) { | 402 | if (nr >= reiserfs_bmap_count(s)) { |
401 | reiserfs_warning(s, "vs-4075: reiserfs_free_block: " | 403 | reiserfs_warning(s, "vs-4075: reiserfs_free_block: " |
402 | "block %lu is out of range on %s", | 404 | "block %lu is out of range on %s " |
403 | block, reiserfs_bdevname(s)); | 405 | "(nr=%u,max=%u)", block, |
406 | reiserfs_bdevname(s), nr, | ||
407 | reiserfs_bmap_count(s)); | ||
404 | return; | 408 | return; |
405 | } | 409 | } |
406 | 410 | ||
@@ -434,12 +438,19 @@ void reiserfs_free_block(struct reiserfs_transaction_handle *th, | |||
434 | int for_unformatted) | 438 | int for_unformatted) |
435 | { | 439 | { |
436 | struct super_block *s = th->t_super; | 440 | struct super_block *s = th->t_super; |
437 | |||
438 | BUG_ON(!th->t_trans_id); | 441 | BUG_ON(!th->t_trans_id); |
439 | 442 | ||
440 | RFALSE(!s, "vs-4061: trying to free block on nonexistent device"); | 443 | RFALSE(!s, "vs-4061: trying to free block on nonexistent device"); |
441 | RFALSE(is_reusable(s, block, 1) == 0, | 444 | if (!is_reusable(s, block, 1)) |
442 | "vs-4071: can not free such block"); | 445 | return; |
446 | |||
447 | if (block > sb_block_count(REISERFS_SB(s)->s_rs)) { | ||
448 | reiserfs_panic(th->t_super, "bitmap-4072", | ||
449 | "Trying to free block outside file system " | ||
450 | "boundaries (%lu > %lu)", | ||
451 | block, sb_block_count(REISERFS_SB(s)->s_rs)); | ||
452 | return; | ||
453 | } | ||
443 | /* mark it before we clear it, just in case */ | 454 | /* mark it before we clear it, just in case */ |
444 | journal_mark_freed(th, s, block); | 455 | journal_mark_freed(th, s, block); |
445 | _reiserfs_free_block(th, inode, block, for_unformatted); | 456 | _reiserfs_free_block(th, inode, block, for_unformatted); |
@@ -449,11 +460,11 @@ void reiserfs_free_block(struct reiserfs_transaction_handle *th, | |||
449 | static void reiserfs_free_prealloc_block(struct reiserfs_transaction_handle *th, | 460 | static void reiserfs_free_prealloc_block(struct reiserfs_transaction_handle *th, |
450 | struct inode *inode, b_blocknr_t block) | 461 | struct inode *inode, b_blocknr_t block) |
451 | { | 462 | { |
463 | BUG_ON(!th->t_trans_id); | ||
452 | RFALSE(!th->t_super, | 464 | RFALSE(!th->t_super, |
453 | "vs-4060: trying to free block on nonexistent device"); | 465 | "vs-4060: trying to free block on nonexistent device"); |
454 | RFALSE(is_reusable(th->t_super, block, 1) == 0, | 466 | if (!is_reusable(th->t_super, block, 1)) |
455 | "vs-4070: can not free such block"); | 467 | return; |
456 | BUG_ON(!th->t_trans_id); | ||
457 | _reiserfs_free_block(th, inode, block, 1); | 468 | _reiserfs_free_block(th, inode, block, 1); |
458 | } | 469 | } |
459 | 470 | ||
@@ -1207,27 +1218,22 @@ void reiserfs_cache_bitmap_metadata(struct super_block *sb, | |||
1207 | { | 1218 | { |
1208 | unsigned long *cur = (unsigned long *)(bh->b_data + bh->b_size); | 1219 | unsigned long *cur = (unsigned long *)(bh->b_data + bh->b_size); |
1209 | 1220 | ||
1210 | info->first_zero_hint = 1 << (sb->s_blocksize_bits + 3); | 1221 | /* The first bit must ALWAYS be 1 */ |
1222 | BUG_ON(!reiserfs_test_le_bit(0, (unsigned long *)bh->b_data)); | ||
1223 | |||
1224 | info->free_count = 0; | ||
1211 | 1225 | ||
1212 | while (--cur >= (unsigned long *)bh->b_data) { | 1226 | while (--cur >= (unsigned long *)bh->b_data) { |
1213 | int base = ((char *)cur - bh->b_data) << 3; | 1227 | int i; |
1214 | 1228 | ||
1215 | /* 0 and ~0 are special, we can optimize for them */ | 1229 | /* 0 and ~0 are special, we can optimize for them */ |
1216 | if (*cur == 0) { | 1230 | if (*cur == 0) |
1217 | info->first_zero_hint = base; | ||
1218 | info->free_count += BITS_PER_LONG; | 1231 | info->free_count += BITS_PER_LONG; |
1219 | } else if (*cur != ~0L) { /* A mix, investigate */ | 1232 | else if (*cur != ~0L) /* A mix, investigate */ |
1220 | int b; | 1233 | for (i = BITS_PER_LONG - 1; i >= 0; i--) |
1221 | for (b = BITS_PER_LONG - 1; b >= 0; b--) { | 1234 | if (!reiserfs_test_le_bit(i, cur)) |
1222 | if (!reiserfs_test_le_bit(b, cur)) { | ||
1223 | info->first_zero_hint = base + b; | ||
1224 | info->free_count++; | 1235 | info->free_count++; |
1225 | } | ||
1226 | } | ||
1227 | } | ||
1228 | } | 1236 | } |
1229 | /* The first bit must ALWAYS be 1 */ | ||
1230 | BUG_ON(info->first_zero_hint == 0); | ||
1231 | } | 1237 | } |
1232 | 1238 | ||
1233 | struct buffer_head *reiserfs_read_bitmap_block(struct super_block *sb, | 1239 | struct buffer_head *reiserfs_read_bitmap_block(struct super_block *sb, |
@@ -1257,7 +1263,7 @@ struct buffer_head *reiserfs_read_bitmap_block(struct super_block *sb, | |||
1257 | BUG_ON(!buffer_uptodate(bh)); | 1263 | BUG_ON(!buffer_uptodate(bh)); |
1258 | BUG_ON(atomic_read(&bh->b_count) == 0); | 1264 | BUG_ON(atomic_read(&bh->b_count) == 0); |
1259 | 1265 | ||
1260 | if (info->first_zero_hint == 0) | 1266 | if (info->free_count == UINT_MAX) |
1261 | reiserfs_cache_bitmap_metadata(sb, bh, info); | 1267 | reiserfs_cache_bitmap_metadata(sb, bh, info); |
1262 | } | 1268 | } |
1263 | 1269 | ||
@@ -1267,12 +1273,13 @@ struct buffer_head *reiserfs_read_bitmap_block(struct super_block *sb, | |||
1267 | int reiserfs_init_bitmap_cache(struct super_block *sb) | 1273 | int reiserfs_init_bitmap_cache(struct super_block *sb) |
1268 | { | 1274 | { |
1269 | struct reiserfs_bitmap_info *bitmap; | 1275 | struct reiserfs_bitmap_info *bitmap; |
1276 | unsigned int bmap_nr = reiserfs_bmap_count(sb); | ||
1270 | 1277 | ||
1271 | bitmap = vmalloc(sizeof (*bitmap) * SB_BMAP_NR(sb)); | 1278 | bitmap = vmalloc(sizeof(*bitmap) * bmap_nr); |
1272 | if (bitmap == NULL) | 1279 | if (bitmap == NULL) |
1273 | return -ENOMEM; | 1280 | return -ENOMEM; |
1274 | 1281 | ||
1275 | memset(bitmap, 0, sizeof (*bitmap) * SB_BMAP_NR(sb)); | 1282 | memset(bitmap, 0xff, sizeof(*bitmap) * bmap_nr); |
1276 | 1283 | ||
1277 | SB_AP_BITMAP(sb) = bitmap; | 1284 | SB_AP_BITMAP(sb) = bitmap; |
1278 | 1285 | ||
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index 0804289d35..a991af96f3 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c | |||
@@ -199,7 +199,7 @@ static inline void set_block_dev_mapped(struct buffer_head *bh, | |||
199 | // files which were created in the earlier version can not be longer, | 199 | // files which were created in the earlier version can not be longer, |
200 | // than 2 gb | 200 | // than 2 gb |
201 | // | 201 | // |
202 | static int file_capable(struct inode *inode, long block) | 202 | static int file_capable(struct inode *inode, sector_t block) |
203 | { | 203 | { |
204 | if (get_inode_item_key_version(inode) != KEY_FORMAT_3_5 || // it is new file. | 204 | if (get_inode_item_key_version(inode) != KEY_FORMAT_3_5 || // it is new file. |
205 | block < (1 << (31 - inode->i_sb->s_blocksize_bits))) // old file, but 'block' is inside of 2gb | 205 | block < (1 << (31 - inode->i_sb->s_blocksize_bits))) // old file, but 'block' is inside of 2gb |
@@ -242,7 +242,7 @@ static int restart_transaction(struct reiserfs_transaction_handle *th, | |||
242 | // Please improve the english/clarity in the comment above, as it is | 242 | // Please improve the english/clarity in the comment above, as it is |
243 | // hard to understand. | 243 | // hard to understand. |
244 | 244 | ||
245 | static int _get_block_create_0(struct inode *inode, long block, | 245 | static int _get_block_create_0(struct inode *inode, sector_t block, |
246 | struct buffer_head *bh_result, int args) | 246 | struct buffer_head *bh_result, int args) |
247 | { | 247 | { |
248 | INITIALIZE_PATH(path); | 248 | INITIALIZE_PATH(path); |
@@ -250,7 +250,7 @@ static int _get_block_create_0(struct inode *inode, long block, | |||
250 | struct buffer_head *bh; | 250 | struct buffer_head *bh; |
251 | struct item_head *ih, tmp_ih; | 251 | struct item_head *ih, tmp_ih; |
252 | int fs_gen; | 252 | int fs_gen; |
253 | int blocknr; | 253 | b_blocknr_t blocknr; |
254 | char *p = NULL; | 254 | char *p = NULL; |
255 | int chars; | 255 | int chars; |
256 | int ret; | 256 | int ret; |
@@ -569,7 +569,7 @@ static int convert_tail_for_hole(struct inode *inode, | |||
569 | } | 569 | } |
570 | 570 | ||
571 | static inline int _allocate_block(struct reiserfs_transaction_handle *th, | 571 | static inline int _allocate_block(struct reiserfs_transaction_handle *th, |
572 | long block, | 572 | sector_t block, |
573 | struct inode *inode, | 573 | struct inode *inode, |
574 | b_blocknr_t * allocated_block_nr, | 574 | b_blocknr_t * allocated_block_nr, |
575 | struct treepath *path, int flags) | 575 | struct treepath *path, int flags) |
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c index 4cad9e75ef..bb05a3e51b 100644 --- a/fs/reiserfs/journal.c +++ b/fs/reiserfs/journal.c | |||
@@ -219,11 +219,12 @@ static void allocate_bitmap_nodes(struct super_block *p_s_sb) | |||
219 | } | 219 | } |
220 | } | 220 | } |
221 | 221 | ||
222 | static int set_bit_in_list_bitmap(struct super_block *p_s_sb, int block, | 222 | static int set_bit_in_list_bitmap(struct super_block *p_s_sb, |
223 | b_blocknr_t block, | ||
223 | struct reiserfs_list_bitmap *jb) | 224 | struct reiserfs_list_bitmap *jb) |
224 | { | 225 | { |
225 | int bmap_nr = block / (p_s_sb->s_blocksize << 3); | 226 | unsigned int bmap_nr = block / (p_s_sb->s_blocksize << 3); |
226 | int bit_nr = block % (p_s_sb->s_blocksize << 3); | 227 | unsigned int bit_nr = block % (p_s_sb->s_blocksize << 3); |
227 | 228 | ||
228 | if (!jb->bitmaps[bmap_nr]) { | 229 | if (!jb->bitmaps[bmap_nr]) { |
229 | jb->bitmaps[bmap_nr] = get_bitmap_node(p_s_sb); | 230 | jb->bitmaps[bmap_nr] = get_bitmap_node(p_s_sb); |
@@ -239,7 +240,7 @@ static void cleanup_bitmap_list(struct super_block *p_s_sb, | |||
239 | if (jb->bitmaps == NULL) | 240 | if (jb->bitmaps == NULL) |
240 | return; | 241 | return; |
241 | 242 | ||
242 | for (i = 0; i < SB_BMAP_NR(p_s_sb); i++) { | 243 | for (i = 0; i < reiserfs_bmap_count(p_s_sb); i++) { |
243 | if (jb->bitmaps[i]) { | 244 | if (jb->bitmaps[i]) { |
244 | free_bitmap_node(p_s_sb, jb->bitmaps[i]); | 245 | free_bitmap_node(p_s_sb, jb->bitmaps[i]); |
245 | jb->bitmaps[i] = NULL; | 246 | jb->bitmaps[i] = NULL; |
@@ -289,7 +290,7 @@ static int free_bitmap_nodes(struct super_block *p_s_sb) | |||
289 | */ | 290 | */ |
290 | int reiserfs_allocate_list_bitmaps(struct super_block *p_s_sb, | 291 | int reiserfs_allocate_list_bitmaps(struct super_block *p_s_sb, |
291 | struct reiserfs_list_bitmap *jb_array, | 292 | struct reiserfs_list_bitmap *jb_array, |
292 | int bmap_nr) | 293 | unsigned int bmap_nr) |
293 | { | 294 | { |
294 | int i; | 295 | int i; |
295 | int failed = 0; | 296 | int failed = 0; |
@@ -483,7 +484,7 @@ static inline struct reiserfs_journal_cnode *get_journal_hash_dev(struct | |||
483 | ** | 484 | ** |
484 | */ | 485 | */ |
485 | int reiserfs_in_journal(struct super_block *p_s_sb, | 486 | int reiserfs_in_journal(struct super_block *p_s_sb, |
486 | int bmap_nr, int bit_nr, int search_all, | 487 | unsigned int bmap_nr, int bit_nr, int search_all, |
487 | b_blocknr_t * next_zero_bit) | 488 | b_blocknr_t * next_zero_bit) |
488 | { | 489 | { |
489 | struct reiserfs_journal *journal = SB_JOURNAL(p_s_sb); | 490 | struct reiserfs_journal *journal = SB_JOURNAL(p_s_sb); |
@@ -1013,7 +1014,7 @@ static int flush_commit_list(struct super_block *s, | |||
1013 | struct reiserfs_journal_list *jl, int flushall) | 1014 | struct reiserfs_journal_list *jl, int flushall) |
1014 | { | 1015 | { |
1015 | int i; | 1016 | int i; |
1016 | int bn; | 1017 | b_blocknr_t bn; |
1017 | struct buffer_head *tbh = NULL; | 1018 | struct buffer_head *tbh = NULL; |
1018 | unsigned long trans_id = jl->j_trans_id; | 1019 | unsigned long trans_id = jl->j_trans_id; |
1019 | struct reiserfs_journal *journal = SB_JOURNAL(s); | 1020 | struct reiserfs_journal *journal = SB_JOURNAL(s); |
@@ -2307,8 +2308,9 @@ static int journal_read_transaction(struct super_block *p_s_sb, | |||
2307 | Right now it is only used from journal code. But later we might use it | 2308 | Right now it is only used from journal code. But later we might use it |
2308 | from other places. | 2309 | from other places. |
2309 | Note: Do not use journal_getblk/sb_getblk functions here! */ | 2310 | Note: Do not use journal_getblk/sb_getblk functions here! */ |
2310 | static struct buffer_head *reiserfs_breada(struct block_device *dev, int block, | 2311 | static struct buffer_head *reiserfs_breada(struct block_device *dev, |
2311 | int bufsize, unsigned int max_block) | 2312 | b_blocknr_t block, int bufsize, |
2313 | b_blocknr_t max_block) | ||
2312 | { | 2314 | { |
2313 | struct buffer_head *bhlist[BUFNR]; | 2315 | struct buffer_head *bhlist[BUFNR]; |
2314 | unsigned int blocks = BUFNR; | 2316 | unsigned int blocks = BUFNR; |
@@ -2732,7 +2734,7 @@ int journal_init(struct super_block *p_s_sb, const char *j_dev_name, | |||
2732 | journal->j_persistent_trans = 0; | 2734 | journal->j_persistent_trans = 0; |
2733 | if (reiserfs_allocate_list_bitmaps(p_s_sb, | 2735 | if (reiserfs_allocate_list_bitmaps(p_s_sb, |
2734 | journal->j_list_bitmap, | 2736 | journal->j_list_bitmap, |
2735 | SB_BMAP_NR(p_s_sb))) | 2737 | reiserfs_bmap_count(p_s_sb))) |
2736 | goto free_and_return; | 2738 | goto free_and_return; |
2737 | allocate_bitmap_nodes(p_s_sb); | 2739 | allocate_bitmap_nodes(p_s_sb); |
2738 | 2740 | ||
@@ -2740,7 +2742,7 @@ int journal_init(struct super_block *p_s_sb, const char *j_dev_name, | |||
2740 | SB_JOURNAL_1st_RESERVED_BLOCK(p_s_sb) = (old_format ? | 2742 | SB_JOURNAL_1st_RESERVED_BLOCK(p_s_sb) = (old_format ? |
2741 | REISERFS_OLD_DISK_OFFSET_IN_BYTES | 2743 | REISERFS_OLD_DISK_OFFSET_IN_BYTES |
2742 | / p_s_sb->s_blocksize + | 2744 | / p_s_sb->s_blocksize + |
2743 | SB_BMAP_NR(p_s_sb) + | 2745 | reiserfs_bmap_count(p_s_sb) + |
2744 | 1 : | 2746 | 1 : |
2745 | REISERFS_DISK_OFFSET_IN_BYTES / | 2747 | REISERFS_DISK_OFFSET_IN_BYTES / |
2746 | p_s_sb->s_blocksize + 2); | 2748 | p_s_sb->s_blocksize + 2); |
diff --git a/fs/reiserfs/prints.c b/fs/reiserfs/prints.c index bc808a91ee..5e7388b32d 100644 --- a/fs/reiserfs/prints.c +++ b/fs/reiserfs/prints.c | |||
@@ -356,13 +356,11 @@ extern struct tree_balance *cur_tb; | |||
356 | void reiserfs_panic(struct super_block *sb, const char *fmt, ...) | 356 | void reiserfs_panic(struct super_block *sb, const char *fmt, ...) |
357 | { | 357 | { |
358 | do_reiserfs_warning(fmt); | 358 | do_reiserfs_warning(fmt); |
359 | printk(KERN_EMERG "REISERFS: panic (device %s): %s\n", | ||
360 | reiserfs_bdevname(sb), error_buf); | ||
361 | BUG(); | ||
362 | 359 | ||
363 | /* this is not actually called, but makes reiserfs_panic() "noreturn" */ | 360 | dump_stack(); |
364 | panic("REISERFS: panic (device %s): %s\n", | 361 | |
365 | reiserfs_bdevname(sb), error_buf); | 362 | panic(KERN_EMERG "REISERFS: panic (device %s): %s\n", |
363 | reiserfs_bdevname(sb), error_buf); | ||
366 | } | 364 | } |
367 | 365 | ||
368 | void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...) | 366 | void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...) |
diff --git a/fs/reiserfs/resize.c b/fs/reiserfs/resize.c index 976cc7887a..f71c3948ed 100644 --- a/fs/reiserfs/resize.c +++ b/fs/reiserfs/resize.c | |||
@@ -61,7 +61,8 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new) | |||
61 | } | 61 | } |
62 | 62 | ||
63 | /* count used bits in last bitmap block */ | 63 | /* count used bits in last bitmap block */ |
64 | block_r = SB_BLOCK_COUNT(s) - (SB_BMAP_NR(s) - 1) * s->s_blocksize * 8; | 64 | block_r = SB_BLOCK_COUNT(s) - |
65 | (reiserfs_bmap_count(s) - 1) * s->s_blocksize * 8; | ||
65 | 66 | ||
66 | /* count bitmap blocks in new fs */ | 67 | /* count bitmap blocks in new fs */ |
67 | bmap_nr_new = block_count_new / (s->s_blocksize * 8); | 68 | bmap_nr_new = block_count_new / (s->s_blocksize * 8); |
@@ -73,7 +74,7 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new) | |||
73 | 74 | ||
74 | /* save old values */ | 75 | /* save old values */ |
75 | block_count = SB_BLOCK_COUNT(s); | 76 | block_count = SB_BLOCK_COUNT(s); |
76 | bmap_nr = SB_BMAP_NR(s); | 77 | bmap_nr = reiserfs_bmap_count(s); |
77 | 78 | ||
78 | /* resizing of reiserfs bitmaps (journal and real), if needed */ | 79 | /* resizing of reiserfs bitmaps (journal and real), if needed */ |
79 | if (bmap_nr_new > bmap_nr) { | 80 | if (bmap_nr_new > bmap_nr) { |
@@ -119,7 +120,7 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new) | |||
119 | return -ENOMEM; | 120 | return -ENOMEM; |
120 | } | 121 | } |
121 | memset(bitmap, 0, | 122 | memset(bitmap, 0, |
122 | sizeof(struct reiserfs_bitmap_info) * SB_BMAP_NR(s)); | 123 | sizeof(struct reiserfs_bitmap_info) * bmap_nr_new); |
123 | for (i = 0; i < bmap_nr; i++) | 124 | for (i = 0; i < bmap_nr; i++) |
124 | bitmap[i] = old_bitmap[i]; | 125 | bitmap[i] = old_bitmap[i]; |
125 | 126 | ||
@@ -143,7 +144,6 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new) | |||
143 | mark_buffer_dirty(bh); | 144 | mark_buffer_dirty(bh); |
144 | sync_dirty_buffer(bh); | 145 | sync_dirty_buffer(bh); |
145 | // update bitmap_info stuff | 146 | // update bitmap_info stuff |
146 | bitmap[i].first_zero_hint = 1; | ||
147 | bitmap[i].free_count = sb_blocksize(sb) * 8 - 1; | 147 | bitmap[i].free_count = sb_blocksize(sb) * 8 - 1; |
148 | brelse(bh); | 148 | brelse(bh); |
149 | } | 149 | } |
@@ -173,8 +173,6 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new) | |||
173 | for (i = block_r; i < s->s_blocksize * 8; i++) | 173 | for (i = block_r; i < s->s_blocksize * 8; i++) |
174 | reiserfs_test_and_clear_le_bit(i, bh->b_data); | 174 | reiserfs_test_and_clear_le_bit(i, bh->b_data); |
175 | info->free_count += s->s_blocksize * 8 - block_r; | 175 | info->free_count += s->s_blocksize * 8 - block_r; |
176 | if (!info->first_zero_hint) | ||
177 | info->first_zero_hint = block_r; | ||
178 | 176 | ||
179 | journal_mark_dirty(&th, s, bh); | 177 | journal_mark_dirty(&th, s, bh); |
180 | brelse(bh); | 178 | brelse(bh); |
@@ -196,9 +194,6 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new) | |||
196 | brelse(bh); | 194 | brelse(bh); |
197 | 195 | ||
198 | info->free_count -= s->s_blocksize * 8 - block_r_new; | 196 | info->free_count -= s->s_blocksize * 8 - block_r_new; |
199 | /* Extreme case where last bitmap is the only valid block in itself. */ | ||
200 | if (!info->free_count) | ||
201 | info->first_zero_hint = 0; | ||
202 | /* update super */ | 197 | /* update super */ |
203 | reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), 1); | 198 | reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), 1); |
204 | free_blocks = SB_FREE_BLOCKS(s); | 199 | free_blocks = SB_FREE_BLOCKS(s); |
@@ -206,7 +201,7 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new) | |||
206 | free_blocks + (block_count_new - block_count - | 201 | free_blocks + (block_count_new - block_count - |
207 | (bmap_nr_new - bmap_nr))); | 202 | (bmap_nr_new - bmap_nr))); |
208 | PUT_SB_BLOCK_COUNT(s, block_count_new); | 203 | PUT_SB_BLOCK_COUNT(s, block_count_new); |
209 | PUT_SB_BMAP_NR(s, bmap_nr_new); | 204 | PUT_SB_BMAP_NR(s, bmap_would_wrap(bmap_nr_new) ? : bmap_nr_new); |
210 | s->s_dirt = 1; | 205 | s->s_dirt = 1; |
211 | 206 | ||
212 | journal_mark_dirty(&th, s, SB_BUFFER_WITH_SB(s)); | 207 | journal_mark_dirty(&th, s, SB_BUFFER_WITH_SB(s)); |
diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c index 981027d118..ca41567d78 100644 --- a/fs/reiserfs/stree.c +++ b/fs/reiserfs/stree.c | |||
@@ -559,7 +559,7 @@ static int is_tree_node(struct buffer_head *bh, int level) | |||
559 | /* The function is NOT SCHEDULE-SAFE! */ | 559 | /* The function is NOT SCHEDULE-SAFE! */ |
560 | static void search_by_key_reada(struct super_block *s, | 560 | static void search_by_key_reada(struct super_block *s, |
561 | struct buffer_head **bh, | 561 | struct buffer_head **bh, |
562 | unsigned long *b, int num) | 562 | b_blocknr_t *b, int num) |
563 | { | 563 | { |
564 | int i, j; | 564 | int i, j; |
565 | 565 | ||
@@ -611,7 +611,7 @@ int search_by_key(struct super_block *p_s_sb, const struct cpu_key *p_s_key, /* | |||
611 | DISK_LEAF_NODE_LEVEL */ | 611 | DISK_LEAF_NODE_LEVEL */ |
612 | ) | 612 | ) |
613 | { | 613 | { |
614 | int n_block_number; | 614 | b_blocknr_t n_block_number; |
615 | int expected_level; | 615 | int expected_level; |
616 | struct buffer_head *p_s_bh; | 616 | struct buffer_head *p_s_bh; |
617 | struct path_element *p_s_last_element; | 617 | struct path_element *p_s_last_element; |
@@ -619,7 +619,7 @@ int search_by_key(struct super_block *p_s_sb, const struct cpu_key *p_s_key, /* | |||
619 | int right_neighbor_of_leaf_node; | 619 | int right_neighbor_of_leaf_node; |
620 | int fs_gen; | 620 | int fs_gen; |
621 | struct buffer_head *reada_bh[SEARCH_BY_KEY_READA]; | 621 | struct buffer_head *reada_bh[SEARCH_BY_KEY_READA]; |
622 | unsigned long reada_blocks[SEARCH_BY_KEY_READA]; | 622 | b_blocknr_t reada_blocks[SEARCH_BY_KEY_READA]; |
623 | int reada_count = 0; | 623 | int reada_count = 0; |
624 | 624 | ||
625 | #ifdef CONFIG_REISERFS_CHECK | 625 | #ifdef CONFIG_REISERFS_CHECK |
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index b82897ae09..57adfe90d5 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c | |||
@@ -1725,6 +1725,21 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent) | |||
1725 | set_sb_umount_state(rs, REISERFS_ERROR_FS); | 1725 | set_sb_umount_state(rs, REISERFS_ERROR_FS); |
1726 | set_sb_fs_state(rs, 0); | 1726 | set_sb_fs_state(rs, 0); |
1727 | 1727 | ||
1728 | /* Clear out s_bmap_nr if it would wrap. We can handle this | ||
1729 | * case, but older revisions can't. This will cause the | ||
1730 | * file system to fail mount on those older implementations, | ||
1731 | * avoiding corruption. -jeffm */ | ||
1732 | if (bmap_would_wrap(reiserfs_bmap_count(s)) && | ||
1733 | sb_bmap_nr(rs) != 0) { | ||
1734 | reiserfs_warning(s, "super-2030: This file system " | ||
1735 | "claims to use %u bitmap blocks in " | ||
1736 | "its super block, but requires %u. " | ||
1737 | "Clearing to zero.", sb_bmap_nr(rs), | ||
1738 | reiserfs_bmap_count(s)); | ||
1739 | |||
1740 | set_sb_bmap_nr(rs, 0); | ||
1741 | } | ||
1742 | |||
1728 | if (old_format_only(s)) { | 1743 | if (old_format_only(s)) { |
1729 | /* filesystem of format 3.5 either with standard or non-standard | 1744 | /* filesystem of format 3.5 either with standard or non-standard |
1730 | journal */ | 1745 | journal */ |
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c index fab4b9b266..1597f6b649 100644 --- a/fs/reiserfs/xattr.c +++ b/fs/reiserfs/xattr.c | |||
@@ -484,7 +484,7 @@ reiserfs_xattr_set(struct inode *inode, const char *name, const void *buffer, | |||
484 | /* Resize it so we're ok to write there */ | 484 | /* Resize it so we're ok to write there */ |
485 | newattrs.ia_size = buffer_size; | 485 | newattrs.ia_size = buffer_size; |
486 | newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME; | 486 | newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME; |
487 | mutex_lock(&xinode->i_mutex); | 487 | mutex_lock_nested(&xinode->i_mutex, I_MUTEX_XATTR); |
488 | err = notify_change(fp->f_path.dentry, &newattrs); | 488 | err = notify_change(fp->f_path.dentry, &newattrs); |
489 | if (err) | 489 | if (err) |
490 | goto out_filp; | 490 | goto out_filp; |
@@ -1223,7 +1223,8 @@ int reiserfs_xattr_init(struct super_block *s, int mount_flags) | |||
1223 | if (!IS_ERR(dentry)) { | 1223 | if (!IS_ERR(dentry)) { |
1224 | if (!(mount_flags & MS_RDONLY) && !dentry->d_inode) { | 1224 | if (!(mount_flags & MS_RDONLY) && !dentry->d_inode) { |
1225 | struct inode *inode = dentry->d_parent->d_inode; | 1225 | struct inode *inode = dentry->d_parent->d_inode; |
1226 | mutex_lock(&inode->i_mutex); | 1226 | mutex_lock_nested(&inode->i_mutex, |
1227 | I_MUTEX_XATTR); | ||
1227 | err = inode->i_op->mkdir(inode, dentry, 0700); | 1228 | err = inode->i_op->mkdir(inode, dentry, 0700); |
1228 | mutex_unlock(&inode->i_mutex); | 1229 | mutex_unlock(&inode->i_mutex); |
1229 | if (err) { | 1230 | if (err) { |
diff --git a/fs/select.c b/fs/select.c index 7dede89658..47f47925ae 100644 --- a/fs/select.c +++ b/fs/select.c | |||
@@ -177,11 +177,6 @@ get_max: | |||
177 | return max; | 177 | return max; |
178 | } | 178 | } |
179 | 179 | ||
180 | #define BIT(i) (1UL << ((i)&(__NFDBITS-1))) | ||
181 | #define MEM(i,m) ((m)+(unsigned)(i)/__NFDBITS) | ||
182 | #define ISSET(i,m) (((i)&*(m)) != 0) | ||
183 | #define SET(i,m) (*(m) |= (i)) | ||
184 | |||
185 | #define POLLIN_SET (POLLRDNORM | POLLRDBAND | POLLIN | POLLHUP | POLLERR) | 180 | #define POLLIN_SET (POLLRDNORM | POLLRDBAND | POLLIN | POLLHUP | POLLERR) |
186 | #define POLLOUT_SET (POLLWRBAND | POLLWRNORM | POLLOUT | POLLERR) | 181 | #define POLLOUT_SET (POLLWRBAND | POLLWRNORM | POLLOUT | POLLERR) |
187 | #define POLLEX_SET (POLLPRI) | 182 | #define POLLEX_SET (POLLPRI) |
diff --git a/fs/super.c b/fs/super.c index 1bfcca2104..d28fde7e1c 100644 --- a/fs/super.c +++ b/fs/super.c | |||
@@ -40,10 +40,6 @@ | |||
40 | #include <asm/uaccess.h> | 40 | #include <asm/uaccess.h> |
41 | 41 | ||
42 | 42 | ||
43 | void get_filesystem(struct file_system_type *fs); | ||
44 | void put_filesystem(struct file_system_type *fs); | ||
45 | struct file_system_type *get_fs_type(const char *name); | ||
46 | |||
47 | LIST_HEAD(super_blocks); | 43 | LIST_HEAD(super_blocks); |
48 | DEFINE_SPINLOCK(sb_lock); | 44 | DEFINE_SPINLOCK(sb_lock); |
49 | 45 | ||
@@ -336,21 +332,21 @@ struct super_block *sget(struct file_system_type *type, | |||
336 | void *data) | 332 | void *data) |
337 | { | 333 | { |
338 | struct super_block *s = NULL; | 334 | struct super_block *s = NULL; |
339 | struct list_head *p; | 335 | struct super_block *old; |
340 | int err; | 336 | int err; |
341 | 337 | ||
342 | retry: | 338 | retry: |
343 | spin_lock(&sb_lock); | 339 | spin_lock(&sb_lock); |
344 | if (test) list_for_each(p, &type->fs_supers) { | 340 | if (test) { |
345 | struct super_block *old; | 341 | list_for_each_entry(old, &type->fs_supers, s_instances) { |
346 | old = list_entry(p, struct super_block, s_instances); | 342 | if (!test(old, data)) |
347 | if (!test(old, data)) | 343 | continue; |
348 | continue; | 344 | if (!grab_super(old)) |
349 | if (!grab_super(old)) | 345 | goto retry; |
350 | goto retry; | 346 | if (s) |
351 | if (s) | 347 | destroy_super(s); |
352 | destroy_super(s); | 348 | return old; |
353 | return old; | 349 | } |
354 | } | 350 | } |
355 | if (!s) { | 351 | if (!s) { |
356 | spin_unlock(&sb_lock); | 352 | spin_unlock(&sb_lock); |
@@ -948,9 +944,9 @@ do_kern_mount(const char *fstype, int flags, const char *name, void *data) | |||
948 | return mnt; | 944 | return mnt; |
949 | } | 945 | } |
950 | 946 | ||
951 | struct vfsmount *kern_mount(struct file_system_type *type) | 947 | struct vfsmount *kern_mount_data(struct file_system_type *type, void *data) |
952 | { | 948 | { |
953 | return vfs_kern_mount(type, 0, type->name, NULL); | 949 | return vfs_kern_mount(type, MS_KERNMOUNT, type->name, data); |
954 | } | 950 | } |
955 | 951 | ||
956 | EXPORT_SYMBOL(kern_mount); | 952 | EXPORT_SYMBOL_GPL(kern_mount_data); |
diff --git a/fs/xfs/linux-2.6/xfs_export.c b/fs/xfs/linux-2.6/xfs_export.c index 726449d4fd..3586c7a28d 100644 --- a/fs/xfs/linux-2.6/xfs_export.c +++ b/fs/xfs/linux-2.6/xfs_export.c | |||
@@ -54,8 +54,8 @@ xfs_fs_decode_fh( | |||
54 | struct dentry *de), | 54 | struct dentry *de), |
55 | void *context) | 55 | void *context) |
56 | { | 56 | { |
57 | xfs_fid2_t ifid; | 57 | xfs_fid_t ifid; |
58 | xfs_fid2_t pfid; | 58 | xfs_fid_t pfid; |
59 | void *parent = NULL; | 59 | void *parent = NULL; |
60 | int is64 = 0; | 60 | int is64 = 0; |
61 | __u32 *p = fh; | 61 | __u32 *p = fh; |
@@ -144,7 +144,7 @@ xfs_fs_get_dentry( | |||
144 | struct dentry *result; | 144 | struct dentry *result; |
145 | int error; | 145 | int error; |
146 | 146 | ||
147 | error = xfs_vget(XFS_M(sb), &vp, (fid_t *)data); | 147 | error = xfs_vget(XFS_M(sb), &vp, data); |
148 | if (error || vp == NULL) | 148 | if (error || vp == NULL) |
149 | return ERR_PTR(-ESTALE) ; | 149 | return ERR_PTR(-ESTALE) ; |
150 | 150 | ||
diff --git a/fs/xfs/linux-2.6/xfs_export.h b/fs/xfs/linux-2.6/xfs_export.h index e794ca4efc..2f36071a86 100644 --- a/fs/xfs/linux-2.6/xfs_export.h +++ b/fs/xfs/linux-2.6/xfs_export.h | |||
@@ -71,13 +71,13 @@ xfs_fileid_length(int hasparent, int is64) | |||
71 | 71 | ||
72 | /* | 72 | /* |
73 | * Decode encoded inode information (either for the inode itself | 73 | * Decode encoded inode information (either for the inode itself |
74 | * or the parent) into an xfs_fid2_t structure. Advances and | 74 | * or the parent) into an xfs_fid_t structure. Advances and |
75 | * returns the new data pointer | 75 | * returns the new data pointer |
76 | */ | 76 | */ |
77 | static inline __u32 * | 77 | static inline __u32 * |
78 | xfs_fileid_decode_fid2(__u32 *p, xfs_fid2_t *fid, int is64) | 78 | xfs_fileid_decode_fid2(__u32 *p, xfs_fid_t *fid, int is64) |
79 | { | 79 | { |
80 | fid->fid_len = sizeof(xfs_fid2_t) - sizeof(fid->fid_len); | 80 | fid->fid_len = sizeof(xfs_fid_t) - sizeof(fid->fid_len); |
81 | fid->fid_pad = 0; | 81 | fid->fid_pad = 0; |
82 | fid->fid_ino = *p++; | 82 | fid->fid_ino = *p++; |
83 | #if XFS_BIG_INUMS | 83 | #if XFS_BIG_INUMS |
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c index ffec630e7d..2b34bad48b 100644 --- a/fs/xfs/linux-2.6/xfs_ioctl.c +++ b/fs/xfs/linux-2.6/xfs_ioctl.c | |||
@@ -152,11 +152,11 @@ xfs_find_handle( | |||
152 | lock_mode = xfs_ilock_map_shared(ip); | 152 | lock_mode = xfs_ilock_map_shared(ip); |
153 | 153 | ||
154 | /* fill in fid section of handle from inode */ | 154 | /* fill in fid section of handle from inode */ |
155 | handle.ha_fid.xfs_fid_len = sizeof(xfs_fid_t) - | 155 | handle.ha_fid.fid_len = sizeof(xfs_fid_t) - |
156 | sizeof(handle.ha_fid.xfs_fid_len); | 156 | sizeof(handle.ha_fid.fid_len); |
157 | handle.ha_fid.xfs_fid_pad = 0; | 157 | handle.ha_fid.fid_pad = 0; |
158 | handle.ha_fid.xfs_fid_gen = ip->i_d.di_gen; | 158 | handle.ha_fid.fid_gen = ip->i_d.di_gen; |
159 | handle.ha_fid.xfs_fid_ino = ip->i_ino; | 159 | handle.ha_fid.fid_ino = ip->i_ino; |
160 | 160 | ||
161 | xfs_iunlock_map_shared(ip, lock_mode); | 161 | xfs_iunlock_map_shared(ip, lock_mode); |
162 | 162 | ||
@@ -222,10 +222,10 @@ xfs_vget_fsop_handlereq( | |||
222 | if (hlen < sizeof(*handlep)) | 222 | if (hlen < sizeof(*handlep)) |
223 | memset(((char *)handlep) + hlen, 0, sizeof(*handlep) - hlen); | 223 | memset(((char *)handlep) + hlen, 0, sizeof(*handlep) - hlen); |
224 | if (hlen > sizeof(handlep->ha_fsid)) { | 224 | if (hlen > sizeof(handlep->ha_fsid)) { |
225 | if (handlep->ha_fid.xfs_fid_len != | 225 | if (handlep->ha_fid.fid_len != |
226 | (hlen - sizeof(handlep->ha_fsid) | 226 | (hlen - sizeof(handlep->ha_fsid) - |
227 | - sizeof(handlep->ha_fid.xfs_fid_len)) | 227 | sizeof(handlep->ha_fid.fid_len)) || |
228 | || handlep->ha_fid.xfs_fid_pad) | 228 | handlep->ha_fid.fid_pad) |
229 | return XFS_ERROR(EINVAL); | 229 | return XFS_ERROR(EINVAL); |
230 | } | 230 | } |
231 | 231 | ||
@@ -233,9 +233,9 @@ xfs_vget_fsop_handlereq( | |||
233 | * Crack the handle, obtain the inode # & generation # | 233 | * Crack the handle, obtain the inode # & generation # |
234 | */ | 234 | */ |
235 | xfid = (struct xfs_fid *)&handlep->ha_fid; | 235 | xfid = (struct xfs_fid *)&handlep->ha_fid; |
236 | if (xfid->xfs_fid_len == sizeof(*xfid) - sizeof(xfid->xfs_fid_len)) { | 236 | if (xfid->fid_len == sizeof(*xfid) - sizeof(xfid->fid_len)) { |
237 | ino = xfid->xfs_fid_ino; | 237 | ino = xfid->fid_ino; |
238 | igen = xfid->xfs_fid_gen; | 238 | igen = xfid->fid_gen; |
239 | } else { | 239 | } else { |
240 | return XFS_ERROR(EINVAL); | 240 | return XFS_ERROR(EINVAL); |
241 | } | 241 | } |
diff --git a/fs/xfs/xfs_dmops.c b/fs/xfs/xfs_dmops.c index 6cd5704258..a1e55fb9d5 100644 --- a/fs/xfs/xfs_dmops.c +++ b/fs/xfs/xfs_dmops.c | |||
@@ -41,29 +41,16 @@ int | |||
41 | xfs_dmops_get(struct xfs_mount *mp, struct xfs_mount_args *args) | 41 | xfs_dmops_get(struct xfs_mount *mp, struct xfs_mount_args *args) |
42 | { | 42 | { |
43 | if (args->flags & XFSMNT_DMAPI) { | 43 | if (args->flags & XFSMNT_DMAPI) { |
44 | struct xfs_dmops *ops; | 44 | cmn_err(CE_WARN, |
45 | 45 | "XFS: dmapi support not available in this kernel."); | |
46 | ops = symbol_get(xfs_dmcore_xfs); | 46 | return EINVAL; |
47 | if (!ops) { | ||
48 | request_module("xfs_dmapi"); | ||
49 | ops = symbol_get(xfs_dmcore_xfs); | ||
50 | } | ||
51 | |||
52 | if (!ops) { | ||
53 | cmn_err(CE_WARN, "XFS: no dmapi support available."); | ||
54 | return EINVAL; | ||
55 | } | ||
56 | mp->m_dm_ops = ops; | ||
57 | } else { | ||
58 | mp->m_dm_ops = &xfs_dmcore_stub; | ||
59 | } | 47 | } |
60 | 48 | ||
49 | mp->m_dm_ops = &xfs_dmcore_stub; | ||
61 | return 0; | 50 | return 0; |
62 | } | 51 | } |
63 | 52 | ||
64 | void | 53 | void |
65 | xfs_dmops_put(struct xfs_mount *mp) | 54 | xfs_dmops_put(struct xfs_mount *mp) |
66 | { | 55 | { |
67 | if (mp->m_dm_ops != &xfs_dmcore_stub) | ||
68 | symbol_put(xfs_dmcore_xfs); | ||
69 | } | 56 | } |
diff --git a/fs/xfs/xfs_fs.h b/fs/xfs/xfs_fs.h index ec3c9c27e0..aab9662765 100644 --- a/fs/xfs/xfs_fs.h +++ b/fs/xfs/xfs_fs.h | |||
@@ -389,30 +389,13 @@ typedef struct xfs_fsop_attrmulti_handlereq { | |||
389 | */ | 389 | */ |
390 | typedef struct { __u32 val[2]; } xfs_fsid_t; /* file system id type */ | 390 | typedef struct { __u32 val[2]; } xfs_fsid_t; /* file system id type */ |
391 | 391 | ||
392 | |||
393 | #ifndef HAVE_FID | ||
394 | #define MAXFIDSZ 46 | ||
395 | |||
396 | typedef struct fid { | ||
397 | __u16 fid_len; /* length of data in bytes */ | ||
398 | unsigned char fid_data[MAXFIDSZ]; /* data (fid_len worth) */ | ||
399 | } fid_t; | ||
400 | #endif | ||
401 | |||
402 | typedef struct xfs_fid { | 392 | typedef struct xfs_fid { |
403 | __u16 xfs_fid_len; /* length of remainder */ | 393 | __u16 fid_len; /* length of remainder */ |
404 | __u16 xfs_fid_pad; | 394 | __u16 fid_pad; |
405 | __u32 xfs_fid_gen; /* generation number */ | 395 | __u32 fid_gen; /* generation number */ |
406 | __u64 xfs_fid_ino; /* 64 bits inode number */ | 396 | __u64 fid_ino; /* 64 bits inode number */ |
407 | } xfs_fid_t; | 397 | } xfs_fid_t; |
408 | 398 | ||
409 | typedef struct xfs_fid2 { | ||
410 | __u16 fid_len; /* length of remainder */ | ||
411 | __u16 fid_pad; /* padding, must be zero */ | ||
412 | __u32 fid_gen; /* generation number */ | ||
413 | __u64 fid_ino; /* inode number */ | ||
414 | } xfs_fid2_t; | ||
415 | |||
416 | typedef struct xfs_handle { | 399 | typedef struct xfs_handle { |
417 | union { | 400 | union { |
418 | __s64 align; /* force alignment of ha_fid */ | 401 | __s64 align; /* force alignment of ha_fid */ |
@@ -422,9 +405,9 @@ typedef struct xfs_handle { | |||
422 | } xfs_handle_t; | 405 | } xfs_handle_t; |
423 | #define ha_fsid ha_u._ha_fsid | 406 | #define ha_fsid ha_u._ha_fsid |
424 | 407 | ||
425 | #define XFS_HSIZE(handle) (((char *) &(handle).ha_fid.xfs_fid_pad \ | 408 | #define XFS_HSIZE(handle) (((char *) &(handle).ha_fid.fid_pad \ |
426 | - (char *) &(handle)) \ | 409 | - (char *) &(handle)) \ |
427 | + (handle).ha_fid.xfs_fid_len) | 410 | + (handle).ha_fid.fid_len) |
428 | 411 | ||
429 | /* | 412 | /* |
430 | * Flags for going down operation | 413 | * Flags for going down operation |
diff --git a/fs/xfs/xfs_qmops.c b/fs/xfs/xfs_qmops.c index c266a0184b..2ec1d8a273 100644 --- a/fs/xfs/xfs_qmops.c +++ b/fs/xfs/xfs_qmops.c | |||
@@ -135,19 +135,13 @@ int | |||
135 | xfs_qmops_get(struct xfs_mount *mp, struct xfs_mount_args *args) | 135 | xfs_qmops_get(struct xfs_mount *mp, struct xfs_mount_args *args) |
136 | { | 136 | { |
137 | if (args->flags & (XFSMNT_UQUOTA | XFSMNT_PQUOTA | XFSMNT_GQUOTA)) { | 137 | if (args->flags & (XFSMNT_UQUOTA | XFSMNT_PQUOTA | XFSMNT_GQUOTA)) { |
138 | struct xfs_qmops *ops; | 138 | #ifdef CONFIG_XFS_QUOTA |
139 | 139 | mp->m_qm_ops = &xfs_qmcore_xfs; | |
140 | ops = symbol_get(xfs_qmcore_xfs); | 140 | #else |
141 | if (!ops) { | 141 | cmn_err(CE_WARN, |
142 | request_module("xfs_quota"); | 142 | "XFS: qouta support not available in this kernel."); |
143 | ops = symbol_get(xfs_qmcore_xfs); | 143 | return EINVAL; |
144 | } | 144 | #endif |
145 | |||
146 | if (!ops) { | ||
147 | cmn_err(CE_WARN, "XFS: no quota support available."); | ||
148 | return EINVAL; | ||
149 | } | ||
150 | mp->m_qm_ops = ops; | ||
151 | } else { | 145 | } else { |
152 | mp->m_qm_ops = &xfs_qmcore_stub; | 146 | mp->m_qm_ops = &xfs_qmcore_stub; |
153 | } | 147 | } |
@@ -158,6 +152,4 @@ xfs_qmops_get(struct xfs_mount *mp, struct xfs_mount_args *args) | |||
158 | void | 152 | void |
159 | xfs_qmops_put(struct xfs_mount *mp) | 153 | xfs_qmops_put(struct xfs_mount *mp) |
160 | { | 154 | { |
161 | if (mp->m_qm_ops != &xfs_qmcore_stub) | ||
162 | symbol_put(xfs_qmcore_xfs); | ||
163 | } | 155 | } |
diff --git a/fs/xfs/xfs_vfsops.c b/fs/xfs/xfs_vfsops.c index a5a8454f2a..a1544597bc 100644 --- a/fs/xfs/xfs_vfsops.c +++ b/fs/xfs/xfs_vfsops.c | |||
@@ -1635,9 +1635,8 @@ int | |||
1635 | xfs_vget( | 1635 | xfs_vget( |
1636 | xfs_mount_t *mp, | 1636 | xfs_mount_t *mp, |
1637 | bhv_vnode_t **vpp, | 1637 | bhv_vnode_t **vpp, |
1638 | fid_t *fidp) | 1638 | xfs_fid_t *xfid) |
1639 | { | 1639 | { |
1640 | xfs_fid_t *xfid = (struct xfs_fid *)fidp; | ||
1641 | xfs_inode_t *ip; | 1640 | xfs_inode_t *ip; |
1642 | int error; | 1641 | int error; |
1643 | xfs_ino_t ino; | 1642 | xfs_ino_t ino; |
@@ -1647,11 +1646,11 @@ xfs_vget( | |||
1647 | * Invalid. Since handles can be created in user space and passed in | 1646 | * Invalid. Since handles can be created in user space and passed in |
1648 | * via gethandle(), this is not cause for a panic. | 1647 | * via gethandle(), this is not cause for a panic. |
1649 | */ | 1648 | */ |
1650 | if (xfid->xfs_fid_len != sizeof(*xfid) - sizeof(xfid->xfs_fid_len)) | 1649 | if (xfid->fid_len != sizeof(*xfid) - sizeof(xfid->fid_len)) |
1651 | return XFS_ERROR(EINVAL); | 1650 | return XFS_ERROR(EINVAL); |
1652 | 1651 | ||
1653 | ino = xfid->xfs_fid_ino; | 1652 | ino = xfid->fid_ino; |
1654 | igen = xfid->xfs_fid_gen; | 1653 | igen = xfid->fid_gen; |
1655 | 1654 | ||
1656 | /* | 1655 | /* |
1657 | * NFS can sometimes send requests for ino 0. Fail them gracefully. | 1656 | * NFS can sometimes send requests for ino 0. Fail them gracefully. |
diff --git a/fs/xfs/xfs_vfsops.h b/fs/xfs/xfs_vfsops.h index bc99e3eb7d..a592fe02a3 100644 --- a/fs/xfs/xfs_vfsops.h +++ b/fs/xfs/xfs_vfsops.h | |||
@@ -2,7 +2,7 @@ | |||
2 | #define _XFS_VFSOPS_H 1 | 2 | #define _XFS_VFSOPS_H 1 |
3 | 3 | ||
4 | struct cred; | 4 | struct cred; |
5 | struct fid; | 5 | struct xfs_fid; |
6 | struct inode; | 6 | struct inode; |
7 | struct kstatfs; | 7 | struct kstatfs; |
8 | struct xfs_mount; | 8 | struct xfs_mount; |
@@ -17,7 +17,7 @@ int xfs_root(struct xfs_mount *mp, bhv_vnode_t **vpp); | |||
17 | int xfs_statvfs(struct xfs_mount *mp, struct kstatfs *statp, | 17 | int xfs_statvfs(struct xfs_mount *mp, struct kstatfs *statp, |
18 | bhv_vnode_t *vp); | 18 | bhv_vnode_t *vp); |
19 | int xfs_sync(struct xfs_mount *mp, int flags); | 19 | int xfs_sync(struct xfs_mount *mp, int flags); |
20 | int xfs_vget(struct xfs_mount *mp, bhv_vnode_t **vpp, struct fid *fidp); | 20 | int xfs_vget(struct xfs_mount *mp, bhv_vnode_t **vpp, struct xfs_fid *xfid); |
21 | int xfs_parseargs(struct xfs_mount *mp, char *options, | 21 | int xfs_parseargs(struct xfs_mount *mp, char *options, |
22 | struct xfs_mount_args *args, int update); | 22 | struct xfs_mount_args *args, int update); |
23 | int xfs_showargs(struct xfs_mount *mp, struct seq_file *m); | 23 | int xfs_showargs(struct xfs_mount *mp, struct seq_file *m); |
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index 5e3c57ca99..efd5aff9ea 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -3466,23 +3466,14 @@ std_return: | |||
3466 | } | 3466 | } |
3467 | 3467 | ||
3468 | 3468 | ||
3469 | /* | ||
3470 | * xfs_fid2 | ||
3471 | * | ||
3472 | * A fid routine that takes a pointer to a previously allocated | ||
3473 | * fid structure (like xfs_fast_fid) but uses a 64 bit inode number. | ||
3474 | */ | ||
3475 | int | 3469 | int |
3476 | xfs_fid2( | 3470 | xfs_fid2( |
3477 | xfs_inode_t *ip, | 3471 | xfs_inode_t *ip, |
3478 | fid_t *fidp) | 3472 | xfs_fid_t *xfid) |
3479 | { | 3473 | { |
3480 | xfs_fid2_t *xfid = (xfs_fid2_t *)fidp; | ||
3481 | |||
3482 | vn_trace_entry(ip, __FUNCTION__, (inst_t *)__return_address); | 3474 | vn_trace_entry(ip, __FUNCTION__, (inst_t *)__return_address); |
3483 | ASSERT(sizeof(fid_t) >= sizeof(xfs_fid2_t)); | ||
3484 | 3475 | ||
3485 | xfid->fid_len = sizeof(xfs_fid2_t) - sizeof(xfid->fid_len); | 3476 | xfid->fid_len = sizeof(xfs_fid_t) - sizeof(xfid->fid_len); |
3486 | xfid->fid_pad = 0; | 3477 | xfid->fid_pad = 0; |
3487 | /* | 3478 | /* |
3488 | * use memcpy because the inode is a long long and there's no | 3479 | * use memcpy because the inode is a long long and there's no |
diff --git a/fs/xfs/xfs_vnodeops.h b/fs/xfs/xfs_vnodeops.h index f36e74f2f0..b7e461c40c 100644 --- a/fs/xfs/xfs_vnodeops.h +++ b/fs/xfs/xfs_vnodeops.h | |||
@@ -39,7 +39,7 @@ int xfs_readdir(struct xfs_inode *dp, void *dirent, size_t bufsize, | |||
39 | int xfs_symlink(struct xfs_inode *dp, bhv_vname_t *dentry, | 39 | int xfs_symlink(struct xfs_inode *dp, bhv_vname_t *dentry, |
40 | char *target_path, mode_t mode, bhv_vnode_t **vpp, | 40 | char *target_path, mode_t mode, bhv_vnode_t **vpp, |
41 | struct cred *credp); | 41 | struct cred *credp); |
42 | int xfs_fid2(struct xfs_inode *ip, fid_t *fidp); | 42 | int xfs_fid2(struct xfs_inode *ip, struct xfs_fid *xfid); |
43 | int xfs_rwlock(struct xfs_inode *ip, bhv_vrwlock_t locktype); | 43 | int xfs_rwlock(struct xfs_inode *ip, bhv_vrwlock_t locktype); |
44 | void xfs_rwunlock(struct xfs_inode *ip, bhv_vrwlock_t locktype); | 44 | void xfs_rwunlock(struct xfs_inode *ip, bhv_vrwlock_t locktype); |
45 | int xfs_inode_flush(struct xfs_inode *ip, int flags); | 45 | int xfs_inode_flush(struct xfs_inode *ip, int flags); |