Whamcloud - gitweb
LU-8371 llite: Trust creates in revalidate too.
[fs/lustre-release.git] / lustre / llite / file.c
index 37f516d..b7bd2bf 100644 (file)
@@ -414,6 +414,16 @@ out:
        ptlrpc_req_finished(req);
        ll_intent_drop_lock(itp);
 
+       /* We did open by fid, but by the time we got to the server,
+        * the object disappeared. If this is a create, we cannot really
+        * tell the userspace that the file it was trying to create
+        * does not exist. Instead let's return -ESTALE, and the VFS will
+        * retry the create with LOOKUP_REVAL that we are going to catch
+        * in ll_revalidate_dentry() and use lookup then.
+        */
+       if (rc == -ENOENT && itp->it_op & IT_CREAT)
+               rc = -ESTALE;
+
        RETURN(rc);
 }
 
@@ -856,7 +866,7 @@ ll_lease_open(struct inode *inode, struct file *file, fmode_t fmode,
        if (it.it_lock_mode == 0 ||
            it.it_lock_bits != MDS_INODELOCK_OPEN) {
                /* open lock must return for lease */
-               CERROR(DFID "lease granted but no open lock, %d/"LPU64".\n",
+               CERROR(DFID "lease granted but no open lock, %d/%llu.\n",
                        PFID(ll_inode2fid(inode)), it.it_lock_mode,
                        it.it_lock_bits);
                GOTO(out_close, rc = -EPROTO);
@@ -1032,7 +1042,7 @@ int ll_merge_attr(const struct lu_env *env, struct inode *inode)
        if (mtime < attr->cat_mtime)
                mtime = attr->cat_mtime;
 
-       CDEBUG(D_VFSTRACE, DFID" updating i_size "LPU64"\n",
+       CDEBUG(D_VFSTRACE, DFID" updating i_size %llu\n",
               PFID(&lli->lli_fid), attr->cat_size);
 
        i_size_write(inode, attr->cat_size);
@@ -1114,7 +1124,7 @@ ll_file_io_generic(const struct lu_env *env, struct vvp_io_args *args,
 
        ENTRY;
 
-       CDEBUG(D_VFSTRACE, "file: %s, type: %d ppos: "LPU64", count: %zu\n",
+       CDEBUG(D_VFSTRACE, "file: %s, type: %d ppos: %llu, count: %zu\n",
                file_dentry(file)->d_name.name, iot, *ppos, count);
 
 restart:
@@ -2293,7 +2303,7 @@ static int ll_file_futimes_3(struct file *file, const struct ll_futimes_3 *lfu)
  * much more data being sent to the client.
  */
 static int ll_ladvise(struct inode *inode, struct file *file, __u64 flags,
-                     struct lu_ladvise *ladvise)
+                     struct llapi_lu_ladvise *ladvise)
 {
        struct lu_env *env;
        struct cl_io *io;
@@ -2673,7 +2683,7 @@ out:
                RETURN(ll_file_futimes_3(file, &lfu));
        }
        case LL_IOC_LADVISE: {
-               struct ladvise_hdr *ladvise_hdr;
+               struct llapi_ladvise_hdr *ladvise_hdr;
                int i;
                int num_advise;
                int alloc_size = sizeof(*ladvise_hdr);
@@ -2684,7 +2694,7 @@ out:
                        RETURN(-ENOMEM);
 
                if (copy_from_user(ladvise_hdr,
-                                  (const struct ladvise_hdr __user *)arg,
+                                  (const struct llapi_ladvise_hdr __user *)arg,
                                   alloc_size))
                        GOTO(out_ladvise, rc = -EFAULT);
 
@@ -2707,7 +2717,7 @@ out:
                 * TODO: submit multiple advices to one server in a single RPC
                 */
                if (copy_from_user(ladvise_hdr,
-                                  (const struct ladvise_hdr __user *)arg,
+                                  (const struct llapi_ladvise_hdr __user *)arg,
                                   alloc_size))
                        GOTO(out_ladvise, rc = -EFAULT);
 
@@ -3083,8 +3093,8 @@ ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock)
         if (IS_ERR(op_data))
                 RETURN(PTR_ERR(op_data));
 
-       CDEBUG(D_DLMTRACE, "inode="DFID", pid=%u, flags="LPX64", mode=%u, "
-              "start="LPU64", end="LPU64"\n", PFID(ll_inode2fid(inode)),
+       CDEBUG(D_DLMTRACE, "inode="DFID", pid=%u, flags=%#llx, mode=%u, "
+              "start=%llu, end=%llu\n", PFID(ll_inode2fid(inode)),
               flock.l_flock.pid, flags, einfo.ei_mode,
               flock.l_flock.start, flock.l_flock.end);