Whamcloud - gitweb
LU-12275 sec: encryption support for DoM files
[fs/lustre-release.git] / lustre / llite / crypto.c
index 110928a..7e32fa4 100644 (file)
 
 static int ll_get_context(struct inode *inode, void *ctx, size_t len)
 {
-       struct dentry *dentry;
+       struct dentry *dentry = d_find_any_alias(inode);
        int rc;
 
-       if (hlist_empty(&inode->i_dentry))
-               return -ENODATA;
-
-       hlist_for_each_entry(dentry, &inode->i_dentry, d_alias) {
-               break;
-       }
-
        rc = ll_vfs_getxattr(dentry, inode, LL_XATTR_NAME_ENCRYPTION_CONTEXT,
                             ctx, len);
+       if (dentry)
+               dput(dentry);
 
        /* used as encryption unit size */
        if (S_ISREG(inode->i_mode))