aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/Kconfig4
-rw-r--r--fs/aio.c6
-rw-r--r--fs/bio.c23
-rw-r--r--fs/cifs/inode.c6
-rw-r--r--fs/cifs/link.c33
-rw-r--r--fs/debugfs/inode.c1
-rw-r--r--fs/ecryptfs/crypto.c3
-rw-r--r--fs/fuse/dir.c52
-rw-r--r--fs/jfs/jfs_filsys.h2
-rw-r--r--fs/nfs/nfsroot.c13
-rw-r--r--fs/proc/base.c3
-rw-r--r--fs/reiserfs/file.c3
-rw-r--r--fs/reiserfs/journal.c6
-rw-r--r--fs/reiserfs/xattr.c2
-rw-r--r--fs/sysfs/dir.c45
-rw-r--r--fs/sysfs/file.c3
16 files changed, 141 insertions, 64 deletions
diff --git a/fs/Kconfig b/fs/Kconfig
index 7b1511d50b05..b3b5aa0edff9 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -972,7 +972,7 @@ config SYSFS
972 972
973 Some system agents rely on the information in sysfs to operate. 973 Some system agents rely on the information in sysfs to operate.
974 /sbin/hotplug uses device and object attributes in sysfs to assist in 974 /sbin/hotplug uses device and object attributes in sysfs to assist in
975 delegating policy decisions, like persistantly naming devices. 975 delegating policy decisions, like persistently naming devices.
976 976
977 sysfs is currently used by the block subsystem to mount the root 977 sysfs is currently used by the block subsystem to mount the root
978 partition. If sysfs is disabled you must specify the boot device on 978 partition. If sysfs is disabled you must specify the boot device on
@@ -1145,7 +1145,7 @@ config BEFS_FS
1145 help 1145 help
1146 The BeOS File System (BeFS) is the native file system of Be, Inc's 1146 The BeOS File System (BeFS) is the native file system of Be, Inc's
1147 BeOS. Notable features include support for arbitrary attributes 1147 BeOS. Notable features include support for arbitrary attributes
1148 on files and directories, and database-like indeces on selected 1148 on files and directories, and database-like indices on selected
1149 attributes. (Also note that this driver doesn't make those features 1149 attributes. (Also note that this driver doesn't make those features
1150 available at this time). It is a 64 bit filesystem, so it supports 1150 available at this time). It is a 64 bit filesystem, so it supports
1151 extremely large volumes and files. 1151 extremely large volumes and files.
diff --git a/fs/aio.c b/fs/aio.c
index ca1c5180a17f..287a1bc7a182 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -367,8 +367,7 @@ void fastcall __put_ioctx(struct kioctx *ctx)
367{ 367{
368 unsigned nr_events = ctx->max_reqs; 368 unsigned nr_events = ctx->max_reqs;
369 369
370 if (unlikely(ctx->reqs_active)) 370 BUG_ON(ctx->reqs_active);
371 BUG();
372 371
373 cancel_delayed_work(&ctx->wq); 372 cancel_delayed_work(&ctx->wq);
374 flush_workqueue(aio_wq); 373 flush_workqueue(aio_wq);
@@ -505,8 +504,7 @@ static int __aio_put_req(struct kioctx *ctx, struct kiocb *req)
505 assert_spin_locked(&ctx->ctx_lock); 504 assert_spin_locked(&ctx->ctx_lock);
506 505
507 req->ki_users --; 506 req->ki_users --;
508 if (unlikely(req->ki_users < 0)) 507 BUG_ON(req->ki_users < 0);
509 BUG();
510 if (likely(req->ki_users)) 508 if (likely(req->ki_users))
511 return 0; 509 return 0;
512 list_del(&req->ki_list); /* remove from active_reqs */ 510 list_del(&req->ki_list); /* remove from active_reqs */
diff --git a/fs/bio.c b/fs/bio.c
index c6c07ca5b5a9..50c40ce2cead 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -560,10 +560,8 @@ struct bio *bio_copy_user(request_queue_t *q, unsigned long uaddr,
560 break; 560 break;
561 } 561 }
562 562
563 if (bio_add_pc_page(q, bio, page, bytes, 0) < bytes) { 563 if (bio_add_pc_page(q, bio, page, bytes, 0) < bytes)
564 ret = -EINVAL;
565 break; 564 break;
566 }
567 565
568 len -= bytes; 566 len -= bytes;
569 } 567 }
@@ -622,10 +620,9 @@ static struct bio *__bio_map_user_iov(request_queue_t *q,
622 620
623 nr_pages += end - start; 621 nr_pages += end - start;
624 /* 622 /*
625 * transfer and buffer must be aligned to at least hardsector 623 * buffer must be aligned to at least hardsector size for now
626 * size for now, in the future we can relax this restriction
627 */ 624 */
628 if ((uaddr & queue_dma_alignment(q)) || (len & queue_dma_alignment(q))) 625 if (uaddr & queue_dma_alignment(q))
629 return ERR_PTR(-EINVAL); 626 return ERR_PTR(-EINVAL);
630 } 627 }
631 628
@@ -751,7 +748,6 @@ struct bio *bio_map_user_iov(request_queue_t *q, struct block_device *bdev,
751 int write_to_vm) 748 int write_to_vm)
752{ 749{
753 struct bio *bio; 750 struct bio *bio;
754 int len = 0, i;
755 751
756 bio = __bio_map_user_iov(q, bdev, iov, iov_count, write_to_vm); 752 bio = __bio_map_user_iov(q, bdev, iov, iov_count, write_to_vm);
757 753
@@ -766,18 +762,7 @@ struct bio *bio_map_user_iov(request_queue_t *q, struct block_device *bdev,
766 */ 762 */
767 bio_get(bio); 763 bio_get(bio);
768 764
769 for (i = 0; i < iov_count; i++) 765 return bio;
770 len += iov[i].iov_len;
771
772 if (bio->bi_size == len)
773 return bio;
774
775 /*
776 * don't support partial mappings
777 */
778 bio_endio(bio, bio->bi_size, 0);
779 bio_unmap_user(bio);
780 return ERR_PTR(-EINVAL);
781} 766}
782 767
783static void __bio_unmap_user(struct bio *bio) 768static void __bio_unmap_user(struct bio *bio)
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 1ad8c9fcc742..c4fa91b8b62f 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -318,6 +318,7 @@ int cifs_get_inode_info(struct inode **pinode,
318 struct cifs_sb_info *cifs_sb = CIFS_SB(sb); 318 struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
319 char *tmp_path; 319 char *tmp_path;
320 char *buf = NULL; 320 char *buf = NULL;
321 int adjustTZ = FALSE;
321 322
322 pTcon = cifs_sb->tcon; 323 pTcon = cifs_sb->tcon;
323 cFYI(1,("Getting info on %s", search_path)); 324 cFYI(1,("Getting info on %s", search_path));
@@ -348,6 +349,7 @@ int cifs_get_inode_info(struct inode **pinode,
348 pfindData, cifs_sb->local_nls, 349 pfindData, cifs_sb->local_nls,
349 cifs_sb->mnt_cifs_flags & 350 cifs_sb->mnt_cifs_flags &
350 CIFS_MOUNT_MAP_SPECIAL_CHR); 351 CIFS_MOUNT_MAP_SPECIAL_CHR);
352 adjustTZ = TRUE;
351 } 353 }
352 354
353 } 355 }
@@ -444,6 +446,10 @@ int cifs_get_inode_info(struct inode **pinode,
444 inode->i_ctime = 446 inode->i_ctime =
445 cifs_NTtimeToUnix(le64_to_cpu(pfindData->ChangeTime)); 447 cifs_NTtimeToUnix(le64_to_cpu(pfindData->ChangeTime));
446 cFYI(0, ("Attributes came in as 0x%x", attr)); 448 cFYI(0, ("Attributes came in as 0x%x", attr));
449 if(adjustTZ && (pTcon->ses) && (pTcon->ses->server)) {
450 inode->i_ctime.tv_sec += pTcon->ses->server->timeAdj;
451 inode->i_mtime.tv_sec += pTcon->ses->server->timeAdj;
452 }
447 453
448 /* set default mode. will override for dirs below */ 454 /* set default mode. will override for dirs below */
449 if (atomic_read(&cifsInfo->inUse) == 0) 455 if (atomic_read(&cifsInfo->inUse) == 0)
diff --git a/fs/cifs/link.c b/fs/cifs/link.c
index 0bee8b7e521a..8e259969354b 100644
--- a/fs/cifs/link.c
+++ b/fs/cifs/link.c
@@ -69,17 +69,30 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode,
69 rc = -EOPNOTSUPP; 69 rc = -EOPNOTSUPP;
70 } 70 }
71 71
72/* if (!rc) */ 72 d_drop(direntry); /* force new lookup from server of target */
73 { 73
74 /* renew_parental_timestamps(old_file); 74 /* if source file is cached (oplocked) revalidate will not go to server
75 inode->i_nlink++; 75 until the file is closed or oplock broken so update nlinks locally */
76 mark_inode_dirty(inode); 76 if(old_file->d_inode) {
77 d_instantiate(direntry, inode); */ 77 cifsInode = CIFS_I(old_file->d_inode);
78 /* BB add call to either mark inode dirty or refresh its data and timestamp to current time */ 78 if(rc == 0) {
79 old_file->d_inode->i_nlink++;
80 old_file->d_inode->i_ctime = CURRENT_TIME;
81 /* parent dir timestamps will update from srv
82 within a second, would it really be worth it
83 to set the parent dir cifs inode time to zero
84 to force revalidate (faster) for it too? */
85 }
86 /* if not oplocked will force revalidate to get info
87 on source file from srv */
88 cifsInode->time = 0;
89
90 /* Will update parent dir timestamps from srv within a second.
91 Would it really be worth it to set the parent dir (cifs
92 inode) time field to zero to force revalidate on parent
93 directory faster ie
94 CIFS_I(inode)->time = 0; */
79 } 95 }
80 d_drop(direntry); /* force new lookup from server */
81 cifsInode = CIFS_I(old_file->d_inode);
82 cifsInode->time = 0; /* will force revalidate to go get info when needed */
83 96
84cifs_hl_exit: 97cifs_hl_exit:
85 kfree(fromName); 98 kfree(fromName);
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index a736d44989c4..137d76c3f90a 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -21,6 +21,7 @@
21#include <linux/mount.h> 21#include <linux/mount.h>
22#include <linux/pagemap.h> 22#include <linux/pagemap.h>
23#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/kobject.h>
24#include <linux/namei.h> 25#include <linux/namei.h>
25#include <linux/debugfs.h> 26#include <linux/debugfs.h>
26 27
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
index 136175a69332..f63a7755fe86 100644
--- a/fs/ecryptfs/crypto.c
+++ b/fs/ecryptfs/crypto.c
@@ -820,7 +820,8 @@ int ecryptfs_init_crypt_ctx(struct ecryptfs_crypt_stat *crypt_stat)
820 crypt_stat->tfm = crypto_alloc_blkcipher(full_alg_name, 0, 820 crypt_stat->tfm = crypto_alloc_blkcipher(full_alg_name, 0,
821 CRYPTO_ALG_ASYNC); 821 CRYPTO_ALG_ASYNC);
822 kfree(full_alg_name); 822 kfree(full_alg_name);
823 if (!crypt_stat->tfm) { 823 if (IS_ERR(crypt_stat->tfm)) {
824 rc = PTR_ERR(crypt_stat->tfm);
824 ecryptfs_printk(KERN_ERR, "cryptfs: init_crypt_ctx(): " 825 ecryptfs_printk(KERN_ERR, "cryptfs: init_crypt_ctx(): "
825 "Error initializing cipher [%s]\n", 826 "Error initializing cipher [%s]\n",
826 crypt_stat->cipher); 827 crypt_stat->cipher);
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index cfc8f81e60d0..c71a6c092ad9 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -138,6 +138,7 @@ static int fuse_dentry_revalidate(struct dentry *entry, struct nameidata *nd)
138 struct fuse_entry_out outarg; 138 struct fuse_entry_out outarg;
139 struct fuse_conn *fc; 139 struct fuse_conn *fc;
140 struct fuse_req *req; 140 struct fuse_req *req;
141 struct fuse_req *forget_req;
141 struct dentry *parent; 142 struct dentry *parent;
142 143
143 /* Doesn't hurt to "reset" the validity timeout */ 144 /* Doesn't hurt to "reset" the validity timeout */
@@ -152,25 +153,33 @@ static int fuse_dentry_revalidate(struct dentry *entry, struct nameidata *nd)
152 if (IS_ERR(req)) 153 if (IS_ERR(req))
153 return 0; 154 return 0;
154 155
156 forget_req = fuse_get_req(fc);
157 if (IS_ERR(forget_req)) {
158 fuse_put_request(fc, req);
159 return 0;
160 }
161
155 parent = dget_parent(entry); 162 parent = dget_parent(entry);
156 fuse_lookup_init(req, parent->d_inode, entry, &outarg); 163 fuse_lookup_init(req, parent->d_inode, entry, &outarg);
157 request_send(fc, req); 164 request_send(fc, req);
158 dput(parent); 165 dput(parent);
159 err = req->out.h.error; 166 err = req->out.h.error;
167 fuse_put_request(fc, req);
160 /* Zero nodeid is same as -ENOENT */ 168 /* Zero nodeid is same as -ENOENT */
161 if (!err && !outarg.nodeid) 169 if (!err && !outarg.nodeid)
162 err = -ENOENT; 170 err = -ENOENT;
163 if (!err) { 171 if (!err) {
164 struct fuse_inode *fi = get_fuse_inode(inode); 172 struct fuse_inode *fi = get_fuse_inode(inode);
165 if (outarg.nodeid != get_node_id(inode)) { 173 if (outarg.nodeid != get_node_id(inode)) {
166 fuse_send_forget(fc, req, outarg.nodeid, 1); 174 fuse_send_forget(fc, forget_req,
175 outarg.nodeid, 1);
167 return 0; 176 return 0;
168 } 177 }
169 spin_lock(&fc->lock); 178 spin_lock(&fc->lock);
170 fi->nlookup ++; 179 fi->nlookup ++;
171 spin_unlock(&fc->lock); 180 spin_unlock(&fc->lock);
172 } 181 }
173 fuse_put_request(fc, req); 182 fuse_put_request(fc, forget_req);
174 if (err || (outarg.attr.mode ^ inode->i_mode) & S_IFMT) 183 if (err || (outarg.attr.mode ^ inode->i_mode) & S_IFMT)
175 return 0; 184 return 0;
176 185
@@ -221,6 +230,7 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry,
221 struct inode *inode = NULL; 230 struct inode *inode = NULL;
222 struct fuse_conn *fc = get_fuse_conn(dir); 231 struct fuse_conn *fc = get_fuse_conn(dir);
223 struct fuse_req *req; 232 struct fuse_req *req;
233 struct fuse_req *forget_req;
224 234
225 if (entry->d_name.len > FUSE_NAME_MAX) 235 if (entry->d_name.len > FUSE_NAME_MAX)
226 return ERR_PTR(-ENAMETOOLONG); 236 return ERR_PTR(-ENAMETOOLONG);
@@ -229,9 +239,16 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry,
229 if (IS_ERR(req)) 239 if (IS_ERR(req))
230 return ERR_PTR(PTR_ERR(req)); 240 return ERR_PTR(PTR_ERR(req));
231 241
242 forget_req = fuse_get_req(fc);
243 if (IS_ERR(forget_req)) {
244 fuse_put_request(fc, req);
245 return ERR_PTR(PTR_ERR(forget_req));
246 }
247
232 fuse_lookup_init(req, dir, entry, &outarg); 248 fuse_lookup_init(req, dir, entry, &outarg);
233 request_send(fc, req); 249 request_send(fc, req);
234 err = req->out.h.error; 250 err = req->out.h.error;
251 fuse_put_request(fc, req);
235 /* Zero nodeid is same as -ENOENT, but with valid timeout */ 252 /* Zero nodeid is same as -ENOENT, but with valid timeout */
236 if (!err && outarg.nodeid && 253 if (!err && outarg.nodeid &&
237 (invalid_nodeid(outarg.nodeid) || !valid_mode(outarg.attr.mode))) 254 (invalid_nodeid(outarg.nodeid) || !valid_mode(outarg.attr.mode)))
@@ -240,11 +257,11 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry,
240 inode = fuse_iget(dir->i_sb, outarg.nodeid, outarg.generation, 257 inode = fuse_iget(dir->i_sb, outarg.nodeid, outarg.generation,
241 &outarg.attr); 258 &outarg.attr);
242 if (!inode) { 259 if (!inode) {
243 fuse_send_forget(fc, req, outarg.nodeid, 1); 260 fuse_send_forget(fc, forget_req, outarg.nodeid, 1);
244 return ERR_PTR(-ENOMEM); 261 return ERR_PTR(-ENOMEM);
245 } 262 }
246 } 263 }
247 fuse_put_request(fc, req); 264 fuse_put_request(fc, forget_req);
248 if (err && err != -ENOENT) 265 if (err && err != -ENOENT)
249 return ERR_PTR(err); 266 return ERR_PTR(err);
250 267
@@ -388,6 +405,13 @@ static int create_new_entry(struct fuse_conn *fc, struct fuse_req *req,
388 struct fuse_entry_out outarg; 405 struct fuse_entry_out outarg;
389 struct inode *inode; 406 struct inode *inode;
390 int err; 407 int err;
408 struct fuse_req *forget_req;
409
410 forget_req = fuse_get_req(fc);
411 if (IS_ERR(forget_req)) {
412 fuse_put_request(fc, req);
413 return PTR_ERR(forget_req);
414 }
391 415
392 req->in.h.nodeid = get_node_id(dir); 416 req->in.h.nodeid = get_node_id(dir);
393 req->out.numargs = 1; 417 req->out.numargs = 1;
@@ -395,24 +419,24 @@ static int create_new_entry(struct fuse_conn *fc, struct fuse_req *req,
395 req->out.args[0].value = &outarg; 419 req->out.args[0].value = &outarg;
396 request_send(fc, req); 420 request_send(fc, req);
397 err = req->out.h.error; 421 err = req->out.h.error;
398 if (err) { 422 fuse_put_request(fc, req);
399 fuse_put_request(fc, req); 423 if (err)
400 return err; 424 goto out_put_forget_req;
401 } 425
402 err = -EIO; 426 err = -EIO;
403 if (invalid_nodeid(outarg.nodeid)) 427 if (invalid_nodeid(outarg.nodeid))
404 goto out_put_request; 428 goto out_put_forget_req;
405 429
406 if ((outarg.attr.mode ^ mode) & S_IFMT) 430 if ((outarg.attr.mode ^ mode) & S_IFMT)
407 goto out_put_request; 431 goto out_put_forget_req;
408 432
409 inode = fuse_iget(dir->i_sb, outarg.nodeid, outarg.generation, 433 inode = fuse_iget(dir->i_sb, outarg.nodeid, outarg.generation,
410 &outarg.attr); 434 &outarg.attr);
411 if (!inode) { 435 if (!inode) {
412 fuse_send_forget(fc, req, outarg.nodeid, 1); 436 fuse_send_forget(fc, forget_req, outarg.nodeid, 1);
413 return -ENOMEM; 437 return -ENOMEM;
414 } 438 }
415 fuse_put_request(fc, req); 439 fuse_put_request(fc, forget_req);
416 440
417 if (S_ISDIR(inode->i_mode)) { 441 if (S_ISDIR(inode->i_mode)) {
418 struct dentry *alias; 442 struct dentry *alias;
@@ -434,8 +458,8 @@ static int create_new_entry(struct fuse_conn *fc, struct fuse_req *req,
434 fuse_invalidate_attr(dir); 458 fuse_invalidate_attr(dir);
435 return 0; 459 return 0;
436 460
437 out_put_request: 461 out_put_forget_req:
438 fuse_put_request(fc, req); 462 fuse_put_request(fc, forget_req);
439 return err; 463 return err;
440} 464}
441 465
diff --git a/fs/jfs/jfs_filsys.h b/fs/jfs/jfs_filsys.h
index 9901928668cf..eb550b339bb8 100644
--- a/fs/jfs/jfs_filsys.h
+++ b/fs/jfs/jfs_filsys.h
@@ -81,7 +81,7 @@
81#define JFS_SWAP_BYTES 0x00100000 /* running on big endian computer */ 81#define JFS_SWAP_BYTES 0x00100000 /* running on big endian computer */
82 82
83/* Directory index */ 83/* Directory index */
84#define JFS_DIR_INDEX 0x00200000 /* Persistant index for */ 84#define JFS_DIR_INDEX 0x00200000 /* Persistent index for */
85 /* directory entries */ 85 /* directory entries */
86 86
87 87
diff --git a/fs/nfs/nfsroot.c b/fs/nfs/nfsroot.c
index 8dfefe41a8da..75f819dc0255 100644
--- a/fs/nfs/nfsroot.c
+++ b/fs/nfs/nfsroot.c
@@ -98,7 +98,7 @@
98static char nfs_root_name[256] __initdata = ""; 98static char nfs_root_name[256] __initdata = "";
99 99
100/* Address of NFS server */ 100/* Address of NFS server */
101static __u32 servaddr __initdata = 0; 101static __be32 servaddr __initdata = 0;
102 102
103/* Name of directory to mount */ 103/* Name of directory to mount */
104static char nfs_path[NFS_MAXPATHLEN] __initdata = { 0, }; 104static char nfs_path[NFS_MAXPATHLEN] __initdata = { 0, };
@@ -327,7 +327,7 @@ static int __init root_nfs_name(char *name)
327 */ 327 */
328static int __init root_nfs_addr(void) 328static int __init root_nfs_addr(void)
329{ 329{
330 if ((servaddr = root_server_addr) == INADDR_NONE) { 330 if ((servaddr = root_server_addr) == htonl(INADDR_NONE)) {
331 printk(KERN_ERR "Root-NFS: No NFS server available, giving up.\n"); 331 printk(KERN_ERR "Root-NFS: No NFS server available, giving up.\n");
332 return -1; 332 return -1;
333 } 333 }
@@ -411,7 +411,7 @@ __setup("nfsroot=", nfs_root_setup);
411 * Construct sockaddr_in from address and port number. 411 * Construct sockaddr_in from address and port number.
412 */ 412 */
413static inline void 413static inline void
414set_sockaddr(struct sockaddr_in *sin, __u32 addr, __u16 port) 414set_sockaddr(struct sockaddr_in *sin, __be32 addr, __be16 port)
415{ 415{
416 sin->sin_family = AF_INET; 416 sin->sin_family = AF_INET;
417 sin->sin_addr.s_addr = addr; 417 sin->sin_addr.s_addr = addr;
@@ -468,14 +468,13 @@ static int __init root_nfs_ports(void)
468 dprintk("Root-NFS: Portmapper on server returned %d " 468 dprintk("Root-NFS: Portmapper on server returned %d "
469 "as nfsd port\n", port); 469 "as nfsd port\n", port);
470 } 470 }
471 nfs_port = htons(nfs_port);
472 471
473 if ((port = root_nfs_getport(NFS_MNT_PROGRAM, mountd_ver, proto)) < 0) { 472 if ((port = root_nfs_getport(NFS_MNT_PROGRAM, mountd_ver, proto)) < 0) {
474 printk(KERN_ERR "Root-NFS: Unable to get mountd port " 473 printk(KERN_ERR "Root-NFS: Unable to get mountd port "
475 "number from server, using default\n"); 474 "number from server, using default\n");
476 port = mountd_port; 475 port = mountd_port;
477 } 476 }
478 mount_port = htons(port); 477 mount_port = port;
479 dprintk("Root-NFS: mountd port is %d\n", port); 478 dprintk("Root-NFS: mountd port is %d\n", port);
480 479
481 return 0; 480 return 0;
@@ -496,7 +495,7 @@ static int __init root_nfs_get_handle(void)
496 int version = (nfs_data.flags & NFS_MOUNT_VER3) ? 495 int version = (nfs_data.flags & NFS_MOUNT_VER3) ?
497 NFS_MNT3_VERSION : NFS_MNT_VERSION; 496 NFS_MNT3_VERSION : NFS_MNT_VERSION;
498 497
499 set_sockaddr(&sin, servaddr, mount_port); 498 set_sockaddr(&sin, servaddr, htons(mount_port));
500 status = nfsroot_mount(&sin, nfs_path, &fh, version, protocol); 499 status = nfsroot_mount(&sin, nfs_path, &fh, version, protocol);
501 if (status < 0) 500 if (status < 0)
502 printk(KERN_ERR "Root-NFS: Server returned error %d " 501 printk(KERN_ERR "Root-NFS: Server returned error %d "
@@ -519,6 +518,6 @@ void * __init nfs_root_data(void)
519 || root_nfs_ports() < 0 518 || root_nfs_ports() < 0
520 || root_nfs_get_handle() < 0) 519 || root_nfs_get_handle() < 0)
521 return NULL; 520 return NULL;
522 set_sockaddr((struct sockaddr_in *) &nfs_data.addr, servaddr, nfs_port); 521 set_sockaddr((struct sockaddr_in *) &nfs_data.addr, servaddr, htons(nfs_port));
523 return (void*)&nfs_data; 522 return (void*)&nfs_data;
524} 523}
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 8df27401d292..795319c54f72 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -442,7 +442,8 @@ static int mountstats_open(struct inode *inode, struct file *file)
442 442
443 if (task) { 443 if (task) {
444 task_lock(task); 444 task_lock(task);
445 namespace = task->nsproxy->namespace; 445 if (task->nsproxy)
446 namespace = task->nsproxy->namespace;
446 if (namespace) 447 if (namespace)
447 get_namespace(namespace); 448 get_namespace(namespace);
448 task_unlock(task); 449 task_unlock(task);
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c
index b67ce9354048..ac14318c81ba 100644
--- a/fs/reiserfs/file.c
+++ b/fs/reiserfs/file.c
@@ -74,7 +74,8 @@ static int reiserfs_file_release(struct inode *inode, struct file *filp)
74 igrab(inode); 74 igrab(inode);
75 reiserfs_warning(inode->i_sb, 75 reiserfs_warning(inode->i_sb,
76 "pinning inode %lu because the " 76 "pinning inode %lu because the "
77 "preallocation can't be freed"); 77 "preallocation can't be freed",
78 inode->i_ino);
78 goto out; 79 goto out;
79 } 80 }
80 } 81 }
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
index cd1bb75ceb24..7280a23ef344 100644
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -1464,7 +1464,7 @@ static int flush_journal_list(struct super_block *s,
1464 } 1464 }
1465 1465
1466 /* if someone has this block in a newer transaction, just make 1466 /* if someone has this block in a newer transaction, just make
1467 ** sure they are commited, and don't try writing it to disk 1467 ** sure they are committed, and don't try writing it to disk
1468 */ 1468 */
1469 if (pjl) { 1469 if (pjl) {
1470 if (atomic_read(&pjl->j_commit_left)) 1470 if (atomic_read(&pjl->j_commit_left))
@@ -3385,7 +3385,7 @@ static int remove_from_transaction(struct super_block *p_s_sb,
3385 3385
3386/* 3386/*
3387** for any cnode in a journal list, it can only be dirtied of all the 3387** for any cnode in a journal list, it can only be dirtied of all the
3388** transactions that include it are commited to disk. 3388** transactions that include it are committed to disk.
3389** this checks through each transaction, and returns 1 if you are allowed to dirty, 3389** this checks through each transaction, and returns 1 if you are allowed to dirty,
3390** and 0 if you aren't 3390** and 0 if you aren't
3391** 3391**
@@ -3427,7 +3427,7 @@ static int can_dirty(struct reiserfs_journal_cnode *cn)
3427} 3427}
3428 3428
3429/* syncs the commit blocks, but does not force the real buffers to disk 3429/* syncs the commit blocks, but does not force the real buffers to disk
3430** will wait until the current transaction is done/commited before returning 3430** will wait until the current transaction is done/committed before returning
3431*/ 3431*/
3432int journal_end_sync(struct reiserfs_transaction_handle *th, 3432int journal_end_sync(struct reiserfs_transaction_handle *th,
3433 struct super_block *p_s_sb, unsigned long nblocks) 3433 struct super_block *p_s_sb, unsigned long nblocks)
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
index 7bdb0ed443e1..1e4d68590178 100644
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -41,7 +41,7 @@
41#include <linux/reiserfs_xattr.h> 41#include <linux/reiserfs_xattr.h>
42#include <linux/reiserfs_acl.h> 42#include <linux/reiserfs_acl.h>
43#include <asm/uaccess.h> 43#include <asm/uaccess.h>
44#include <asm/checksum.h> 44#include <net/checksum.h>
45#include <linux/smp_lock.h> 45#include <linux/smp_lock.h>
46#include <linux/stat.h> 46#include <linux/stat.h>
47#include <asm/semaphore.h> 47#include <asm/semaphore.h>
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index 3aa3434621ca..a5782e8c7f07 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -372,6 +372,51 @@ int sysfs_rename_dir(struct kobject * kobj, const char *new_name)
372 return error; 372 return error;
373} 373}
374 374
375int sysfs_move_dir(struct kobject *kobj, struct kobject *new_parent)
376{
377 struct dentry *old_parent_dentry, *new_parent_dentry, *new_dentry;
378 struct sysfs_dirent *new_parent_sd, *sd;
379 int error;
380
381 if (!new_parent)
382 return -EINVAL;
383
384 old_parent_dentry = kobj->parent ?
385 kobj->parent->dentry : sysfs_mount->mnt_sb->s_root;
386 new_parent_dentry = new_parent->dentry;
387
388again:
389 mutex_lock(&old_parent_dentry->d_inode->i_mutex);
390 if (!mutex_trylock(&new_parent_dentry->d_inode->i_mutex)) {
391 mutex_unlock(&old_parent_dentry->d_inode->i_mutex);
392 goto again;
393 }
394
395 new_parent_sd = new_parent_dentry->d_fsdata;
396 sd = kobj->dentry->d_fsdata;
397
398 new_dentry = lookup_one_len(kobj->name, new_parent_dentry,
399 strlen(kobj->name));
400 if (IS_ERR(new_dentry)) {
401 error = PTR_ERR(new_dentry);
402 goto out;
403 } else
404 error = 0;
405 d_add(new_dentry, NULL);
406 d_move(kobj->dentry, new_dentry);
407 dput(new_dentry);
408
409 /* Remove from old parent's list and insert into new parent's list. */
410 list_del_init(&sd->s_sibling);
411 list_add(&sd->s_sibling, &new_parent_sd->s_children);
412
413out:
414 mutex_unlock(&new_parent_dentry->d_inode->i_mutex);
415 mutex_unlock(&old_parent_dentry->d_inode->i_mutex);
416
417 return error;
418}
419
375static int sysfs_dir_open(struct inode *inode, struct file *file) 420static int sysfs_dir_open(struct inode *inode, struct file *file)
376{ 421{
377 struct dentry * dentry = file->f_dentry; 422 struct dentry * dentry = file->f_dentry;
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index 298303b5a716..95c165101c98 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -190,6 +190,9 @@ fill_write_buffer(struct sysfs_buffer * buffer, const char __user * buf, size_t
190 count = PAGE_SIZE - 1; 190 count = PAGE_SIZE - 1;
191 error = copy_from_user(buffer->page,buf,count); 191 error = copy_from_user(buffer->page,buf,count);
192 buffer->needs_read_fill = 1; 192 buffer->needs_read_fill = 1;
193 /* if buf is assumed to contain a string, terminate it by \0,
194 so e.g. sscanf() can scan the string easily */
195 buffer->page[count] = 0;
193 return error ? -EFAULT : count; 196 return error ? -EFAULT : count;
194} 197}
195 198