Merge ../linux-2.6-watchdog-mm
[pandora-kernel.git] / include / linux / nfsd / nfsfh.h
index 31a3cb6..d9c6c38 100644 (file)
@@ -157,7 +157,7 @@ typedef struct svc_fh {
        __u64                   fh_post_size;   /* i_size */
        unsigned long           fh_post_blocks; /* i_blocks */
        unsigned long           fh_post_blksize;/* i_blksize */
-       __u32                   fh_post_rdev[2];/* i_rdev */
+       __be32                  fh_post_rdev[2];/* i_rdev */
        struct timespec         fh_post_atime;  /* i_atime */
        struct timespec         fh_post_mtime;  /* i_mtime */
        struct timespec         fh_post_ctime;  /* i_ctime */
@@ -209,19 +209,15 @@ extern char * SVCFH_fmt(struct svc_fh *fhp);
 /*
  * Function prototypes
  */
-u32    fh_verify(struct svc_rqst *, struct svc_fh *, int, int);
-int    fh_compose(struct svc_fh *, struct svc_export *, struct dentry *, struct svc_fh *);
-int    fh_update(struct svc_fh *);
+__be32 fh_verify(struct svc_rqst *, struct svc_fh *, int, int);
+__be32 fh_compose(struct svc_fh *, struct svc_export *, struct dentry *, struct svc_fh *);
+__be32 fh_update(struct svc_fh *);
 void   fh_put(struct svc_fh *);
 
 static __inline__ struct svc_fh *
 fh_copy(struct svc_fh *dst, struct svc_fh *src)
 {
-       if (src->fh_dentry || src->fh_locked) {
-               struct dentry *dentry = src->fh_dentry;
-               printk(KERN_ERR "fh_copy: copying %s/%s, already verified!\n",
-                       dentry->d_parent->d_name.name, dentry->d_name.name);
-       }
+       WARN_ON(src->fh_dentry || src->fh_locked);
                        
        *dst = *src;
        return dst;
@@ -290,8 +286,9 @@ fill_post_wcc(struct svc_fh *fhp)
  * vfs.c:nfsd_rename as it needs to grab 2 i_mutex's at once
  * so, any changes here should be reflected there.
  */
+
 static inline void
-fh_lock(struct svc_fh *fhp)
+fh_lock_nested(struct svc_fh *fhp, unsigned int subclass)
 {
        struct dentry   *dentry = fhp->fh_dentry;
        struct inode    *inode;
@@ -299,10 +296,8 @@ fh_lock(struct svc_fh *fhp)
        dfprintk(FILEOP, "nfsd: fh_lock(%s) locked = %d\n",
                        SVCFH_fmt(fhp), fhp->fh_locked);
 
-       if (!fhp->fh_dentry) {
-               printk(KERN_ERR "fh_lock: fh not verified!\n");
-               return;
-       }
+       BUG_ON(!dentry);
+
        if (fhp->fh_locked) {
                printk(KERN_WARNING "fh_lock: %s/%s already locked!\n",
                        dentry->d_parent->d_name.name, dentry->d_name.name);
@@ -310,19 +305,24 @@ fh_lock(struct svc_fh *fhp)
        }
 
        inode = dentry->d_inode;
-       mutex_lock(&inode->i_mutex);
+       mutex_lock_nested(&inode->i_mutex, subclass);
        fill_pre_wcc(fhp);
        fhp->fh_locked = 1;
 }
 
+static inline void
+fh_lock(struct svc_fh *fhp)
+{
+       fh_lock_nested(fhp, I_MUTEX_NORMAL);
+}
+
 /*
  * Unlock a file handle/inode
  */
 static inline void
 fh_unlock(struct svc_fh *fhp)
 {
-       if (!fhp->fh_dentry)
-               printk(KERN_ERR "fh_unlock: fh not verified!\n");
+       BUG_ON(!fhp->fh_dentry);
 
        if (fhp->fh_locked) {
                fill_post_wcc(fhp);