diff options
| author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-09 18:29:58 -0400 | 
|---|---|---|
| committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-09 18:29:58 -0400 | 
| commit | d0b6e0e380d6a32d479120a8b5d98cdff936ec8c (patch) | |
| tree | 57b584f4ba8504eb39e9f12234fc78db7fff0477 | |
| parent | 5329571b3c978635f6d832cc884fdd61ff94e0da (diff) | |
| parent | 7a13e932281e7042a592f4f14db0b348199e7aac (diff) | |
Merge git://git.linux-nfs.org/pub/linux/nfs-2.6
* git://git.linux-nfs.org/pub/linux/nfs-2.6:
  NFS: Kill the obsolete NFS_PARANOIA
  NFS: use __set_current_state()
  sunrpc: fix crash in rpc_malloc()
  NFS: Clean up NFSv4 XDR error message
  NFS: NFS client underestimates how large an NFSv4 SETATTR reply can be
  SUNRPC: Fix pointer arithmetic bug recently introduced in rpc_malloc/free
  NFS: Remove redundant check in nfs_check_verifier()
  NFS: Fix a jiffie wraparound issue
| -rw-r--r-- | fs/nfs/dir.c | 37 | ||||
| -rw-r--r-- | fs/nfs/getroot.c | 1 | ||||
| -rw-r--r-- | fs/nfs/idmap.c | 4 | ||||
| -rw-r--r-- | fs/nfs/inode.c | 3 | ||||
| -rw-r--r-- | fs/nfs/nfs2xdr.c | 1 | ||||
| -rw-r--r-- | fs/nfs/nfs4xdr.c | 11 | ||||
| -rw-r--r-- | fs/nfs/pagelist.c | 7 | ||||
| -rw-r--r-- | net/sunrpc/sched.c | 26 | 
8 files changed, 41 insertions, 49 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 625d8e5fb39d..3df428816559 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c  | |||
| @@ -38,7 +38,6 @@ | |||
| 38 | #include "delegation.h" | 38 | #include "delegation.h" | 
| 39 | #include "iostat.h" | 39 | #include "iostat.h" | 
| 40 | 40 | ||
| 41 | #define NFS_PARANOIA 1 | ||
| 42 | /* #define NFS_DEBUG_VERBOSE 1 */ | 41 | /* #define NFS_DEBUG_VERBOSE 1 */ | 
| 43 | 42 | ||
| 44 | static int nfs_opendir(struct inode *, struct file *); | 43 | static int nfs_opendir(struct inode *, struct file *); | 
| @@ -650,12 +649,15 @@ int nfs_fsync_dir(struct file *filp, struct dentry *dentry, int datasync) | |||
| 650 | */ | 649 | */ | 
| 651 | static int nfs_check_verifier(struct inode *dir, struct dentry *dentry) | 650 | static int nfs_check_verifier(struct inode *dir, struct dentry *dentry) | 
| 652 | { | 651 | { | 
| 652 | unsigned long verf; | ||
| 653 | |||
| 653 | if (IS_ROOT(dentry)) | 654 | if (IS_ROOT(dentry)) | 
| 654 | return 1; | 655 | return 1; | 
| 655 | if ((NFS_I(dir)->cache_validity & NFS_INO_INVALID_ATTR) != 0 | 656 | verf = (unsigned long)dentry->d_fsdata; | 
| 656 | || nfs_attribute_timeout(dir)) | 657 | if (nfs_caches_unstable(dir) | 
| 658 | || verf != NFS_I(dir)->cache_change_attribute) | ||
| 657 | return 0; | 659 | return 0; | 
| 658 | return nfs_verify_change_attribute(dir, (unsigned long)dentry->d_fsdata); | 660 | return 1; | 
| 659 | } | 661 | } | 
| 660 | 662 | ||
| 661 | static inline void nfs_set_verifier(struct dentry * dentry, unsigned long verf) | 663 | static inline void nfs_set_verifier(struct dentry * dentry, unsigned long verf) | 
| @@ -665,8 +667,7 @@ static inline void nfs_set_verifier(struct dentry * dentry, unsigned long verf) | |||
| 665 | 667 | ||
| 666 | static void nfs_refresh_verifier(struct dentry * dentry, unsigned long verf) | 668 | static void nfs_refresh_verifier(struct dentry * dentry, unsigned long verf) | 
| 667 | { | 669 | { | 
| 668 | if (time_after(verf, (unsigned long)dentry->d_fsdata)) | 670 | nfs_set_verifier(dentry, verf); | 
| 669 | nfs_set_verifier(dentry, verf); | ||
| 670 | } | 671 | } | 
| 671 | 672 | ||
| 672 | /* | 673 | /* | 
| @@ -765,6 +766,10 @@ static int nfs_lookup_revalidate(struct dentry * dentry, struct nameidata *nd) | |||
| 765 | nfs_inc_stats(dir, NFSIOS_DENTRYREVALIDATE); | 766 | nfs_inc_stats(dir, NFSIOS_DENTRYREVALIDATE); | 
| 766 | inode = dentry->d_inode; | 767 | inode = dentry->d_inode; | 
| 767 | 768 | ||
| 769 | /* Revalidate parent directory attribute cache */ | ||
| 770 | if (nfs_revalidate_inode(NFS_SERVER(dir), dir) < 0) | ||
| 771 | goto out_zap_parent; | ||
| 772 | |||
| 768 | if (!inode) { | 773 | if (!inode) { | 
| 769 | if (nfs_neg_need_reval(dir, dentry, nd)) | 774 | if (nfs_neg_need_reval(dir, dentry, nd)) | 
| 770 | goto out_bad; | 775 | goto out_bad; | 
| @@ -778,10 +783,6 @@ static int nfs_lookup_revalidate(struct dentry * dentry, struct nameidata *nd) | |||
| 778 | goto out_bad; | 783 | goto out_bad; | 
| 779 | } | 784 | } | 
| 780 | 785 | ||
| 781 | /* Revalidate parent directory attribute cache */ | ||
| 782 | if (nfs_revalidate_inode(NFS_SERVER(dir), dir) < 0) | ||
| 783 | goto out_zap_parent; | ||
| 784 | |||
| 785 | /* Force a full look up iff the parent directory has changed */ | 786 | /* Force a full look up iff the parent directory has changed */ | 
| 786 | if (nfs_check_verifier(dir, dentry)) { | 787 | if (nfs_check_verifier(dir, dentry)) { | 
| 787 | if (nfs_lookup_verify_inode(inode, nd)) | 788 | if (nfs_lookup_verify_inode(inode, nd)) | 
| @@ -1360,11 +1361,6 @@ static int nfs_sillyrename(struct inode *dir, struct dentry *dentry) | |||
| 1360 | atomic_read(&dentry->d_count)); | 1361 | atomic_read(&dentry->d_count)); | 
| 1361 | nfs_inc_stats(dir, NFSIOS_SILLYRENAME); | 1362 | nfs_inc_stats(dir, NFSIOS_SILLYRENAME); | 
| 1362 | 1363 | ||
| 1363 | #ifdef NFS_PARANOIA | ||
| 1364 | if (!dentry->d_inode) | ||
| 1365 | printk("NFS: silly-renaming %s/%s, negative dentry??\n", | ||
| 1366 | dentry->d_parent->d_name.name, dentry->d_name.name); | ||
| 1367 | #endif | ||
| 1368 | /* | 1364 | /* | 
| 1369 | * We don't allow a dentry to be silly-renamed twice. | 1365 | * We don't allow a dentry to be silly-renamed twice. | 
| 1370 | */ | 1366 | */ | 
| @@ -1681,16 +1677,9 @@ static int nfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
| 1681 | new_inode = NULL; | 1677 | new_inode = NULL; | 
| 1682 | /* instantiate the replacement target */ | 1678 | /* instantiate the replacement target */ | 
| 1683 | d_instantiate(new_dentry, NULL); | 1679 | d_instantiate(new_dentry, NULL); | 
| 1684 | } else if (atomic_read(&new_dentry->d_count) > 1) { | 1680 | } else if (atomic_read(&new_dentry->d_count) > 1) | 
| 1685 | /* dentry still busy? */ | 1681 | /* dentry still busy? */ | 
| 1686 | #ifdef NFS_PARANOIA | ||
| 1687 | printk("nfs_rename: target %s/%s busy, d_count=%d\n", | ||
| 1688 | new_dentry->d_parent->d_name.name, | ||
| 1689 | new_dentry->d_name.name, | ||
| 1690 | atomic_read(&new_dentry->d_count)); | ||
| 1691 | #endif | ||
| 1692 | goto out; | 1682 | goto out; | 
| 1693 | } | ||
| 1694 | } else | 1683 | } else | 
| 1695 | drop_nlink(new_inode); | 1684 | drop_nlink(new_inode); | 
| 1696 | 1685 | ||
diff --git a/fs/nfs/getroot.c b/fs/nfs/getroot.c index 234778576f09..d1cbf0a0fbb2 100644 --- a/fs/nfs/getroot.c +++ b/fs/nfs/getroot.c  | |||
| @@ -41,7 +41,6 @@ | |||
| 41 | #include "internal.h" | 41 | #include "internal.h" | 
| 42 | 42 | ||
| 43 | #define NFSDBG_FACILITY NFSDBG_CLIENT | 43 | #define NFSDBG_FACILITY NFSDBG_CLIENT | 
| 44 | #define NFS_PARANOIA 1 | ||
| 45 | 44 | ||
| 46 | /* | 45 | /* | 
| 47 | * get an NFS2/NFS3 root dentry from the root filehandle | 46 | * get an NFS2/NFS3 root dentry from the root filehandle | 
diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c index 9d4a6b2d1996..d11eb055265c 100644 --- a/fs/nfs/idmap.c +++ b/fs/nfs/idmap.c  | |||
| @@ -272,7 +272,7 @@ nfs_idmap_id(struct idmap *idmap, struct idmap_hashtable *h, | |||
| 272 | set_current_state(TASK_UNINTERRUPTIBLE); | 272 | set_current_state(TASK_UNINTERRUPTIBLE); | 
| 273 | mutex_unlock(&idmap->idmap_im_lock); | 273 | mutex_unlock(&idmap->idmap_im_lock); | 
| 274 | schedule(); | 274 | schedule(); | 
| 275 | current->state = TASK_RUNNING; | 275 | __set_current_state(TASK_RUNNING); | 
| 276 | remove_wait_queue(&idmap->idmap_wq, &wq); | 276 | remove_wait_queue(&idmap->idmap_wq, &wq); | 
| 277 | mutex_lock(&idmap->idmap_im_lock); | 277 | mutex_lock(&idmap->idmap_im_lock); | 
| 278 | 278 | ||
| @@ -333,7 +333,7 @@ nfs_idmap_name(struct idmap *idmap, struct idmap_hashtable *h, | |||
| 333 | set_current_state(TASK_UNINTERRUPTIBLE); | 333 | set_current_state(TASK_UNINTERRUPTIBLE); | 
| 334 | mutex_unlock(&idmap->idmap_im_lock); | 334 | mutex_unlock(&idmap->idmap_im_lock); | 
| 335 | schedule(); | 335 | schedule(); | 
| 336 | current->state = TASK_RUNNING; | 336 | __set_current_state(TASK_RUNNING); | 
| 337 | remove_wait_queue(&idmap->idmap_wq, &wq); | 337 | remove_wait_queue(&idmap->idmap_wq, &wq); | 
| 338 | mutex_lock(&idmap->idmap_im_lock); | 338 | mutex_lock(&idmap->idmap_im_lock); | 
| 339 | 339 | ||
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 1e9a915d1fea..2a3fd9573207 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c  | |||
| @@ -48,7 +48,6 @@ | |||
| 48 | #include "internal.h" | 48 | #include "internal.h" | 
| 49 | 49 | ||
| 50 | #define NFSDBG_FACILITY NFSDBG_VFS | 50 | #define NFSDBG_FACILITY NFSDBG_VFS | 
| 51 | #define NFS_PARANOIA 1 | ||
| 52 | 51 | ||
| 53 | static void nfs_invalidate_inode(struct inode *); | 52 | static void nfs_invalidate_inode(struct inode *); | 
| 54 | static int nfs_update_inode(struct inode *, struct nfs_fattr *); | 53 | static int nfs_update_inode(struct inode *, struct nfs_fattr *); | 
| @@ -1075,10 +1074,8 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
| 1075 | /* | 1074 | /* | 
| 1076 | * Big trouble! The inode has become a different object. | 1075 | * Big trouble! The inode has become a different object. | 
| 1077 | */ | 1076 | */ | 
| 1078 | #ifdef NFS_PARANOIA | ||
| 1079 | printk(KERN_DEBUG "%s: inode %ld mode changed, %07o to %07o\n", | 1077 | printk(KERN_DEBUG "%s: inode %ld mode changed, %07o to %07o\n", | 
| 1080 | __FUNCTION__, inode->i_ino, inode->i_mode, fattr->mode); | 1078 | __FUNCTION__, inode->i_ino, inode->i_mode, fattr->mode); | 
| 1081 | #endif | ||
| 1082 | out_err: | 1079 | out_err: | 
| 1083 | /* | 1080 | /* | 
| 1084 | * No need to worry about unhashing the dentry, as the | 1081 | * No need to worry about unhashing the dentry, as the | 
diff --git a/fs/nfs/nfs2xdr.c b/fs/nfs/nfs2xdr.c index abd9f8b48943..cd3ca7b5d3db 100644 --- a/fs/nfs/nfs2xdr.c +++ b/fs/nfs/nfs2xdr.c  | |||
| @@ -26,7 +26,6 @@ | |||
| 26 | #include "internal.h" | 26 | #include "internal.h" | 
| 27 | 27 | ||
| 28 | #define NFSDBG_FACILITY NFSDBG_XDR | 28 | #define NFSDBG_FACILITY NFSDBG_XDR | 
| 29 | /* #define NFS_PARANOIA 1 */ | ||
| 30 | 29 | ||
| 31 | /* Mapping from NFS error code to "errno" error code. */ | 30 | /* Mapping from NFS error code to "errno" error code. */ | 
| 32 | #define errno_NFSERR_IO EIO | 31 | #define errno_NFSERR_IO EIO | 
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index b8c28f2380a5..938f37166788 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c  | |||
| @@ -224,7 +224,8 @@ static int nfs4_stat_to_errno(int); | |||
| 224 | encode_getattr_maxsz) | 224 | encode_getattr_maxsz) | 
| 225 | #define NFS4_dec_setattr_sz (compound_decode_hdr_maxsz + \ | 225 | #define NFS4_dec_setattr_sz (compound_decode_hdr_maxsz + \ | 
| 226 | decode_putfh_maxsz + \ | 226 | decode_putfh_maxsz + \ | 
| 227 | op_decode_hdr_maxsz + 3) | 227 | op_decode_hdr_maxsz + 3 + \ | 
| 228 | nfs4_fattr_maxsz) | ||
| 228 | #define NFS4_enc_fsinfo_sz (compound_encode_hdr_maxsz + \ | 229 | #define NFS4_enc_fsinfo_sz (compound_encode_hdr_maxsz + \ | 
| 229 | encode_putfh_maxsz + \ | 230 | encode_putfh_maxsz + \ | 
| 230 | encode_fsinfo_maxsz) | 231 | encode_fsinfo_maxsz) | 
| @@ -2079,9 +2080,11 @@ out: | |||
| 2079 | 2080 | ||
| 2080 | #define READ_BUF(nbytes) do { \ | 2081 | #define READ_BUF(nbytes) do { \ | 
| 2081 | p = xdr_inline_decode(xdr, nbytes); \ | 2082 | p = xdr_inline_decode(xdr, nbytes); \ | 
| 2082 | if (!p) { \ | 2083 | if (unlikely(!p)) { \ | 
| 2083 | printk(KERN_WARNING "%s: reply buffer overflowed in line %d.", \ | 2084 | printk(KERN_INFO "%s: prematurely hit end of receive" \ | 
| 2084 | __FUNCTION__, __LINE__); \ | 2085 | " buffer\n", __FUNCTION__); \ | 
| 2086 | printk(KERN_INFO "%s: xdr->p=%p, bytes=%u, xdr->end=%p\n", \ | ||
| 2087 | __FUNCTION__, xdr->p, nbytes, xdr->end); \ | ||
| 2085 | return -EIO; \ | 2088 | return -EIO; \ | 
| 2086 | } \ | 2089 | } \ | 
| 2087 | } while (0) | 2090 | } while (0) | 
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index 388950118f59..e12054c86d0d 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c  | |||
| @@ -20,8 +20,6 @@ | |||
| 20 | 20 | ||
| 21 | #include "internal.h" | 21 | #include "internal.h" | 
| 22 | 22 | ||
| 23 | #define NFS_PARANOIA 1 | ||
| 24 | |||
| 25 | static struct kmem_cache *nfs_page_cachep; | 23 | static struct kmem_cache *nfs_page_cachep; | 
| 26 | 24 | ||
| 27 | static inline struct nfs_page * | 25 | static inline struct nfs_page * | 
| @@ -167,11 +165,6 @@ nfs_release_request(struct nfs_page *req) | |||
| 167 | if (!atomic_dec_and_test(&req->wb_count)) | 165 | if (!atomic_dec_and_test(&req->wb_count)) | 
| 168 | return; | 166 | return; | 
| 169 | 167 | ||
| 170 | #ifdef NFS_PARANOIA | ||
| 171 | BUG_ON (!list_empty(&req->wb_list)); | ||
| 172 | BUG_ON (NFS_WBACK_BUSY(req)); | ||
| 173 | #endif | ||
| 174 | |||
| 175 | /* Release struct file or cached credential */ | 168 | /* Release struct file or cached credential */ | 
| 176 | nfs_clear_request(req); | 169 | nfs_clear_request(req); | 
| 177 | put_nfs_open_context(req->wb_context); | 170 | put_nfs_open_context(req->wb_context); | 
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index 99014516b73c..b011eb625e49 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c  | |||
| @@ -736,6 +736,11 @@ static void rpc_async_schedule(struct work_struct *work) | |||
| 736 | __rpc_execute(container_of(work, struct rpc_task, u.tk_work)); | 736 | __rpc_execute(container_of(work, struct rpc_task, u.tk_work)); | 
| 737 | } | 737 | } | 
| 738 | 738 | ||
| 739 | struct rpc_buffer { | ||
| 740 | size_t len; | ||
| 741 | char data[]; | ||
| 742 | }; | ||
| 743 | |||
| 739 | /** | 744 | /** | 
| 740 | * rpc_malloc - allocate an RPC buffer | 745 | * rpc_malloc - allocate an RPC buffer | 
| 741 | * @task: RPC task that will use this buffer | 746 | * @task: RPC task that will use this buffer | 
| @@ -754,18 +759,22 @@ static void rpc_async_schedule(struct work_struct *work) | |||
| 754 | */ | 759 | */ | 
| 755 | void *rpc_malloc(struct rpc_task *task, size_t size) | 760 | void *rpc_malloc(struct rpc_task *task, size_t size) | 
| 756 | { | 761 | { | 
| 757 | size_t *buf; | 762 | struct rpc_buffer *buf; | 
| 758 | gfp_t gfp = RPC_IS_SWAPPER(task) ? GFP_ATOMIC : GFP_NOWAIT; | 763 | gfp_t gfp = RPC_IS_SWAPPER(task) ? GFP_ATOMIC : GFP_NOWAIT; | 
| 759 | 764 | ||
| 760 | size += sizeof(size_t); | 765 | size += sizeof(struct rpc_buffer); | 
| 761 | if (size <= RPC_BUFFER_MAXSIZE) | 766 | if (size <= RPC_BUFFER_MAXSIZE) | 
| 762 | buf = mempool_alloc(rpc_buffer_mempool, gfp); | 767 | buf = mempool_alloc(rpc_buffer_mempool, gfp); | 
| 763 | else | 768 | else | 
| 764 | buf = kmalloc(size, gfp); | 769 | buf = kmalloc(size, gfp); | 
| 765 | *buf = size; | 770 | |
| 771 | if (!buf) | ||
| 772 | return NULL; | ||
| 773 | |||
| 774 | buf->len = size; | ||
| 766 | dprintk("RPC: %5u allocated buffer of size %zu at %p\n", | 775 | dprintk("RPC: %5u allocated buffer of size %zu at %p\n", | 
| 767 | task->tk_pid, size, buf); | 776 | task->tk_pid, size, buf); | 
| 768 | return ++buf; | 777 | return &buf->data; | 
| 769 | } | 778 | } | 
| 770 | 779 | ||
| 771 | /** | 780 | /** | 
| @@ -775,15 +784,18 @@ void *rpc_malloc(struct rpc_task *task, size_t size) | |||
| 775 | */ | 784 | */ | 
| 776 | void rpc_free(void *buffer) | 785 | void rpc_free(void *buffer) | 
| 777 | { | 786 | { | 
| 778 | size_t size, *buf = buffer; | 787 | size_t size; | 
| 788 | struct rpc_buffer *buf; | ||
| 779 | 789 | ||
| 780 | if (!buffer) | 790 | if (!buffer) | 
| 781 | return; | 791 | return; | 
| 782 | size = *buf; | 792 | |
| 783 | buf--; | 793 | buf = container_of(buffer, struct rpc_buffer, data); | 
| 794 | size = buf->len; | ||
| 784 | 795 | ||
| 785 | dprintk("RPC: freeing buffer of size %zu at %p\n", | 796 | dprintk("RPC: freeing buffer of size %zu at %p\n", | 
| 786 | size, buf); | 797 | size, buf); | 
| 798 | |||
| 787 | if (size <= RPC_BUFFER_MAXSIZE) | 799 | if (size <= RPC_BUFFER_MAXSIZE) | 
| 788 | mempool_free(buf, rpc_buffer_mempool); | 800 | mempool_free(buf, rpc_buffer_mempool); | 
| 789 | else | 801 | else | 
