int rc = 0;
unsigned wsize = 1 << inode->i_blkbits;
+ client = ceph_inode_to_client(inode);
+
+ dout(1, "writepage client=%p\n", client);
+ if (client->mount_state == CEPH_MOUNT_SHUTDOWN) {
+ dout(1, "writepage on forced umount\n");
+ return -EIO; /* we're in a forced umount, don't write anything! */
+ }
+
if (client->mount_args.wsize && client->mount_args.wsize < wsize)
wsize = client->mount_args.wsize;
if (wsize < PAGE_CACHE_SIZE)
int i;
int n;
unsigned long started, timeout = 30 * HZ;
+ struct ceph_client *client = mdsc->client;
dout(10, "close_sessions\n");
mdsc->stopping = 1;
if (n == 0)
break;
+ if (client->mount_state == CEPH_MOUNT_SHUTDOWN)
+ break;
+
dout(10, "waiting for sessions to close\n");
mutex_unlock(&mdsc->mutex);
up_write(&mdsc->snap_rwsem);
+
wait_for_completion_timeout(&mdsc->session_close_waiters,
timeout);
mutex_lock(&mdsc->mutex);
void ceph_monc_request_umount(struct ceph_mon_client *monc)
{
+ struct ceph_client *client=monc->client;
+
+ if (client->mount_state == CEPH_MOUNT_SHUTDOWN)
+ return;
+
mutex_lock(&monc->req_mutex);
monc->umount_delay = BASE_DELAY_INTERVAL;
do_request_umount(&monc->umount_delayed_work.work);
ceph_mdsc_close_sessions(&cl->mdsc);
ceph_monc_request_umount(&cl->monc);
- rc = wait_event_timeout(cl->mount_wq,
- (cl->mount_state == CEPH_MOUNT_UNMOUNTED),
- seconds*HZ);
- if (rc == 0)
- derr(0, "umount timed out after %d seconds\n", seconds);
+ if (cl->mount_state != CEPH_MOUNT_SHUTDOWN) {
+ rc = wait_event_timeout(cl->mount_wq,
+ (cl->mount_state == CEPH_MOUNT_UNMOUNTED),
+ seconds*HZ);
+ if (rc == 0)
+ derr(0, "umount timed out after %d seconds\n", seconds);
+ }
return;
}
kmem_cache_destroy(ceph_inode_cachep);
}
+static void ceph_umount_begin(struct vfsmount *vfsmnt, int flags)
+{
+ struct ceph_client *client = ceph_sb_to_client(vfsmnt->mnt_sb);
+
+ dout(30, "ceph_umount_begin\n");
+
+ if (!(flags & MNT_FORCE))
+ return;
+
+ if (!client)
+ return;
+
+ client->mount_state = CEPH_MOUNT_SHUTDOWN;
+
+ return;
+}
+
+
static const struct super_operations ceph_super_ops = {
.alloc_inode = ceph_alloc_inode,
.destroy_inode = ceph_destroy_inode,
.put_super = ceph_put_super,
.show_options = ceph_show_options,
.statfs = ceph_statfs,
+ .umount_begin = ceph_umount_begin,
};
}
-
-
-
/************************************/
static struct file_system_type ceph_fs_type = {