+/*
+ * dentry_open handles its own reference counting since Linux v3.6
+ * (commit 765927b2). Callers should free their own references.
+ *
+ * Prior versions expected the caller to increment the references.
+ * The references are retained on success and freed on error.
+ */
+static inline struct file *ll_dentry_open(struct path *path, int flags,
+ const struct cred *cred)
+{
+ mntget(path->mnt);
+ dget(path->dentry);
+# ifdef HAVE_DENTRY_OPEN_4ARGS
+ return dentry_open(path->dentry, path->mnt, flags, cred);
+# else
+ return dentry_open(path->dentry, path->mnt, flags);
+# endif