Update fs/ to use sg helpers
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / fs / nfsd / nfs4recover.c
index e9d07704680e7f5e99adad09c643f24e16442ee1..6f03918018a3106b0ffdedb0da170c5613a05c69 100644 (file)
@@ -45,7 +45,7 @@
 #include <asm/uaccess.h>
 #include <asm/scatterlist.h>
 #include <linux/crypto.h>
-
+#include <linux/sched.h>
 
 #define NFSDDBG_FACILITY                NFSDDBG_PROC
 
@@ -88,7 +88,7 @@ nfs4_make_rec_clidname(char *dname, struct xdr_netobj *clname)
 {
        struct xdr_netobj cksum;
        struct hash_desc desc;
-       struct scatterlist sg[1];
+       struct scatterlist sg;
        __be32 status = nfserr_resource;
 
        dprintk("NFSD: nfs4_make_rec_clidname for %.*s\n",
@@ -102,11 +102,9 @@ nfs4_make_rec_clidname(char *dname, struct xdr_netobj *clname)
        if (cksum.data == NULL)
                goto out;
 
-       sg[0].page = virt_to_page(clname->data);
-       sg[0].offset = offset_in_page(clname->data);
-       sg[0].length = clname->len;
+       sg_init_one(&sg, clname->data, clname->len);
 
-       if (crypto_hash_digest(&desc, sg, sg->length, cksum.data))
+       if (crypto_hash_digest(&desc, &sg, sg.length, cksum.data))
                goto out;
 
        md5_to_hex(dname, cksum.data);
@@ -259,7 +257,7 @@ nfsd4_remove_clid_file(struct dentry *dir, struct dentry *dentry)
                printk("nfsd4: non-file found in client recovery directory\n");
                return -EINVAL;
        }
-       mutex_lock(&dir->d_inode->i_mutex);
+       mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT);
        status = vfs_unlink(dir->d_inode, dentry);
        mutex_unlock(&dir->d_inode->i_mutex);
        return status;
@@ -274,7 +272,7 @@ nfsd4_clear_clid_dir(struct dentry *dir, struct dentry *dentry)
         * any regular files anyway, just in case the directory was created by
         * a kernel from the future.... */
        nfsd4_list_rec_dir(dentry, nfsd4_remove_clid_file);
-       mutex_lock(&dir->d_inode->i_mutex);
+       mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT);
        status = vfs_rmdir(dir->d_inode, dentry);
        mutex_unlock(&dir->d_inode->i_mutex);
        return status;