/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
* vim:expandtab:shiftwidth=8:tabstop=8:
*
- * lustre/osd/osd_handler.c
- * Top-level entry points into osd module
+ * GPL HEADER START
*
- * Copyright (c) 2006 Cluster File Systems, Inc.
- * Author: Nikita Danilov <nikita@clusterfs.com>
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * This file is part of the Lustre file system, http://www.lustre.org
- * Lustre is a trademark of Cluster File Systems, Inc.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 only,
+ * as published by the Free Software Foundation.
*
- * You may have signed or agreed to another license before downloading
- * this software. If so, you are bound by the terms and conditions
- * of that agreement, and the following does not apply to you. See the
- * LICENSE file included with this distribution for more information.
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License version 2 for more details (a copy is included
+ * in the LICENSE file that accompanied this code).
*
- * If you did not agree to a different license, then this copy of Lustre
- * is open source software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
+ * You should have received a copy of the GNU General Public License
+ * version 2 along with this program; If not, see
+ * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
*
- * In either case, Lustre is distributed in the hope that it will be
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * license text for more details.
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ * GPL HEADER END
+ */
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved
+ * Use is subject to license terms.
+ */
+/*
+ * This file is part of Lustre, http://www.lustre.org/
+ * Lustre is a trademark of Sun Microsystems, Inc.
+ *
+ * lustre/osd/osd_handler.c
+ *
+ * Top-level entry points into osd module
+ *
+ * Author: Nikita Danilov <nikita@clusterfs.com>
*/
#ifndef EXPORT_SYMTAB
LASSERT(th != NULL);
spin_lock(&obj->oo_guard);
- if (inode->i_nlink < LDISKFS_LINK_MAX) {
- inode->i_nlink ++;
- spin_unlock(&obj->oo_guard);
- mark_inode_dirty(inode);
- } else {
- spin_unlock(&obj->oo_guard);
- LU_OBJECT_DEBUG(D_ERROR, env, &dt->do_lu,
- "Overflowed nlink\n");
- }
+ LASSERT(inode->i_nlink < LDISKFS_LINK_MAX);
+ inode->i_nlink++;
+ spin_unlock(&obj->oo_guard);
+ mark_inode_dirty(inode);
LASSERT(osd_invariant(obj));
}
LASSERT(th != NULL);
spin_lock(&obj->oo_guard);
- if (inode->i_nlink > 0) {
- inode->i_nlink --;
- spin_unlock(&obj->oo_guard);
- mark_inode_dirty(inode);
- } else {
- spin_unlock(&obj->oo_guard);
- LU_OBJECT_DEBUG(D_ERROR, env, &dt->do_lu,
- "Underflowed nlink\n");
- }
+ LASSERT(inode->i_nlink > 0);
+ inode->i_nlink--;
+ spin_unlock(&obj->oo_guard);
+ mark_inode_dirty(inode);
LASSERT(osd_invariant(obj));
}
const struct lu_buf *buf, const char *name, int fl,
struct thandle *handle, struct lustre_capa *capa)
{
- int fs_flags;
-
struct osd_object *obj = osd_dt_obj(dt);
struct inode *inode = obj->oo_inode;
struct osd_thread_info *info = osd_oti_get(env);
struct dentry *dentry = &info->oti_dentry;
+ struct timespec *t = &info->oti_time;
+ int fs_flags = 0, rc;
LASSERT(dt_object_exists(dt));
LASSERT(inode->i_op != NULL && inode->i_op->setxattr != NULL);
if (osd_object_auth(env, dt, capa, CAPA_OPC_META_WRITE))
return -EACCES;
- dentry->d_inode = inode;
-
- fs_flags = 0;
if (fl & LU_XATTR_REPLACE)
fs_flags |= XATTR_REPLACE;
if (fl & LU_XATTR_CREATE)
fs_flags |= XATTR_CREATE;
- return inode->i_op->setxattr(dentry, name,
- buf->lb_buf, buf->lb_len, fs_flags);
+ dentry->d_inode = inode;
+ *t = inode->i_ctime;
+ rc = inode->i_op->setxattr(dentry, name,
+ buf->lb_buf, buf->lb_len, fs_flags);
+ if (likely(rc == 0)) {
+ /* ctime should not be updated with server-side time. */
+ spin_lock(&obj->oo_guard);
+ inode->i_ctime = *t;
+ spin_unlock(&obj->oo_guard);
+ mark_inode_dirty(inode);
+ }
+ return rc;
}
/*
struct inode *inode = obj->oo_inode;
struct osd_thread_info *info = osd_oti_get(env);
struct dentry *dentry = &info->oti_dentry;
+ struct timespec *t = &info->oti_time;
+ int rc;
LASSERT(dt_object_exists(dt));
LASSERT(inode->i_op != NULL && inode->i_op->removexattr != NULL);
return -EACCES;
dentry->d_inode = inode;
- return inode->i_op->removexattr(dentry, name);
+ *t = inode->i_ctime;
+ rc = inode->i_op->removexattr(dentry, name);
+ if (likely(rc == 0)) {
+ /* ctime should not be updated with server-side time. */
+ spin_lock(&obj->oo_guard);
+ inode->i_ctime = *t;
+ spin_unlock(&obj->oo_guard);
+ mark_inode_dirty(inode);
+ }
+ return rc;
}
static struct obd_capa *osd_capa_get(const struct lu_env *env,
if (result == 0) {
struct dentry *d;
- d = simple_mkdir(osd_sb(o)->s_root, "*OBJ-TEMP*", 0777, 1);
+ d = simple_mkdir(osd_sb(o)->s_root, lmi->lmi_mnt, "*OBJ-TEMP*",
+ 0777, 1);
if (!IS_ERR(d)) {
o->od_obj_area = d;
} else
spin_lock_init(&o->od_osfs_lock);
o->od_osfs_age = cfs_time_shift_64(-1000);
o->od_capa_hash = init_capa_hash();
- if (o->od_capa_hash == NULL)
+ if (o->od_capa_hash == NULL) {
+ dt_device_fini(&o->od_dt_dev);
l = ERR_PTR(-ENOMEM);
+ }
} else
l = ERR_PTR(result);
+
+ if (IS_ERR(l))
+ OBD_FREE_PTR(o);
} else
l = ERR_PTR(-ENOMEM);
return l;
class_unregister_type(LUSTRE_OSD_NAME);
}
-MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
+MODULE_AUTHOR("Sun Microsystems, Inc. <http://www.lustre.org/>");
MODULE_DESCRIPTION("Lustre Object Storage Device ("LUSTRE_OSD_NAME")");
MODULE_LICENSE("GPL");