Whamcloud - gitweb
LU-13 updated patch to fix at_min issue
[fs/lustre-release.git] / lustre / liblustre / file.c
index 3cef55c..aa56124 100644 (file)
@@ -26,7 +26,7 @@
  * GPL HEADER END
  */
 /*
- * Copyright  2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  */
 /*
 #include <sys/queue.h>
 #include <fcntl.h>
 
-#include <sysio.h>
-#ifdef HAVE_XTIO_H
-#include <xtio.h>
-#endif
-#include <fs.h>
-#include <mount.h>
-#include <inode.h>
-#ifdef HAVE_FILE_H
-#include <file.h>
-#endif
-
-#undef LIST_HEAD
-
 #include "llite_lib.h"
 
 /* Pack the required supplementary groups into the supplied groups array.
@@ -73,13 +60,13 @@ void ll_i2gids(__u32 *suppgids, struct inode *i1, struct inode *i2)
         LASSERT(i1 != NULL);
         LASSERT(suppgids != NULL);
 
-        if (in_group_p(i1->i_stbuf.st_gid))
+        if (cfs_curproc_is_in_groups(i1->i_stbuf.st_gid))
                 suppgids[0] = i1->i_stbuf.st_gid;
         else
                 suppgids[0] = -1;
 
         if (i2) {
-                if (in_group_p(i2->i_stbuf.st_gid))
+                if (cfs_curproc_is_in_groups(i2->i_stbuf.st_gid))
                         suppgids[1] = i2->i_stbuf.st_gid;
                 else
                         suppgids[1] = -1;
@@ -112,7 +99,7 @@ void llu_prep_md_op_data(struct md_op_data *op_data, struct inode *i1,
         op_data->op_name = name;
         op_data->op_mode = mode;
         op_data->op_namelen = namelen;
-        op_data->op_mod_time = CURRENT_TIME;
+        op_data->op_mod_time = CFS_CURRENT_TIME;
         op_data->op_data = NULL;
 }
 
@@ -137,16 +124,10 @@ void obdo_refresh_inode(struct inode *dst,
 
         if (valid & OBD_MD_FLATIME && src->o_atime > LTIME_S(st->st_atime))
                 LTIME_S(st->st_atime) = src->o_atime;
-
-        /* mtime is always updated with ctime, but can be set in past.
-           As write and utime(2) may happen within 1 second, and utime's
-           mtime has a priority over write's one, leave mtime from mds
-           for the same ctimes. */
-        if (valid & OBD_MD_FLCTIME && src->o_ctime > LTIME_S(st->st_ctime)) {
+        if (valid & OBD_MD_FLMTIME && src->o_mtime > LTIME_S(st->st_mtime))
+                LTIME_S(st->st_mtime) = src->o_mtime;
+        if (valid & OBD_MD_FLCTIME && src->o_ctime > LTIME_S(st->st_ctime))
                 LTIME_S(st->st_ctime) = src->o_ctime;
-                if (valid & OBD_MD_FLMTIME)
-                        LTIME_S(st->st_mtime) = src->o_mtime;
-        }
         if (valid & OBD_MD_FLSIZE && src->o_size > st->st_size)
                 st->st_size = src->o_size;
         /* optimum IO size */
@@ -312,9 +293,10 @@ int llu_objects_destroy(struct ptlrpc_request *req, struct inode *dir)
                 GOTO(out_free_memmd, rc = -ENOMEM);
 
         oa->o_id = lsm->lsm_object_id;
-        oa->o_gr = lsm->lsm_object_gr;
+        oa->o_seq = lsm->lsm_object_seq;
         oa->o_mode = body->mode & S_IFMT;
         oa->o_valid = OBD_MD_FLID | OBD_MD_FLTYPE | OBD_MD_FLGROUP;
+        obdo_from_inode(oa, NULL, &llu_i2info(dir)->lli_fid, 0);
 
         if (body->valid & OBD_MD_FLCOOKIE) {
                 oa->o_valid |= OBD_MD_FLCOOKIE;