struct portals_handle {
struct list_head h_link;
__u64 h_cookie;
- const void *h_owner;
- struct portals_handle_ops *h_ops;
+ const struct portals_handle_ops *h_ops;
/* newly added fields to handle the RCU issue. -jxiong */
struct rcu_head h_rcu;
/* Add a handle to the hash table */
void class_handle_hash(struct portals_handle *,
- struct portals_handle_ops *ops);
+ const struct portals_handle_ops *ops);
void class_handle_unhash(struct portals_handle *);
-void *class_handle2object(__u64 cookie, const void *owner);
+void *class_handle2object(u64 cookie, const struct portals_handle_ops *ops);
void class_handle_free_cb(struct rcu_head *rcu);
int class_handle_init(void);
void class_handle_cleanup(void);
LASSERT(handle);
- lock = class_handle2object(handle->cookie, NULL);
+ lock = class_handle2object(handle->cookie, &lock_handle_ops);
if (lock == NULL)
RETURN(NULL);
struct mdt_file_data {
/** portals handle must be first */
struct portals_handle mfd_open_handle;
+ /* export data of portals_handle */
+ const struct mdt_export_data *mfd_owner;
/** open mode provided by client */
u64 mfd_open_flags;
/** protected by med_open_lock */
{
}
-static struct portals_handle_ops mfd_open_handle_ops = {
+static const struct portals_handle_ops mfd_open_handle_ops = {
.hop_addref = mdt_mfd_get,
.hop_free = NULL,
};
OBD_ALLOC_PTR(mfd);
if (mfd != NULL) {
INIT_LIST_HEAD_RCU(&mfd->mfd_open_handle.h_link);
- mfd->mfd_open_handle.h_owner = med;
+ mfd->mfd_owner = med;
INIT_LIST_HEAD(&mfd->mfd_list);
class_handle_hash(&mfd->mfd_open_handle, &mfd_open_handle_ops);
}
ENTRY;
LASSERT(open_handle != NULL);
- mfd = class_handle2object(open_handle->cookie, med);
+ mfd = class_handle2object(open_handle->cookie, &mfd_open_handle_ops);
/* during dw/setattr replay the mfd can be found by old handle */
- if (mfd == NULL && is_replay_or_resent) {
+ if ((!mfd || mfd->mfd_owner != med) && is_replay_or_resent) {
list_for_each_entry(mfd, &med->med_open_head, mfd_list) {
if (mfd->mfd_open_handle_old.cookie ==
open_handle->cookie)
RETURN(rc);
}
+static struct portals_handle_ops export_handle_ops;
+
/* map connection to client */
struct obd_export *class_conn2export(struct lustre_handle *conn)
{
}
CDEBUG(D_INFO, "looking for export cookie %#llx\n", conn->cookie);
- export = class_handle2object(conn->cookie, NULL);
+ export = class_handle2object(conn->cookie, &export_handle_ops);
RETURN(export);
}
EXPORT_SYMBOL(class_conn2export);
* global (per-node) hash-table.
*/
void class_handle_hash(struct portals_handle *h,
- struct portals_handle_ops *ops)
+ const struct portals_handle_ops *ops)
{
struct handle_bucket *bucket;
}
EXPORT_SYMBOL(class_handle_unhash);
-void *class_handle2object(__u64 cookie, const void *owner)
+void *class_handle2object(u64 cookie, const struct portals_handle_ops *ops)
{
struct handle_bucket *bucket;
struct portals_handle *h;
rcu_read_lock();
list_for_each_entry_rcu(h, &bucket->head, h_link) {
- if (h->h_cookie != cookie || h->h_owner != owner)
+ if (h->h_cookie != cookie || h->h_ops != ops)
continue;
spin_lock(&h->h_lock);