vdev_file.c (236155) | vdev_file.c (241896) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 40 unchanged lines hidden (view full) --- 49 50static int 51vdev_file_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize, 52 uint64_t *ashift) 53{ 54 vdev_file_t *vf; 55 vnode_t *vp; 56 vattr_t vattr; | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 40 unchanged lines hidden (view full) --- 49 50static int 51vdev_file_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize, 52 uint64_t *ashift) 53{ 54 vdev_file_t *vf; 55 vnode_t *vp; 56 vattr_t vattr; |
57 int error, vfslocked; | 57 int error; |
58 59 /* 60 * We must have a pathname, and it must be absolute. 61 */ 62 if (vd->vdev_path == NULL || vd->vdev_path[0] != '/') { 63 vd->vdev_stat.vs_aux = VDEV_AUX_BAD_LABEL; 64 return (EINVAL); 65 } --- 43 unchanged lines hidden (view full) --- 109 } 110#endif 111 112skip_open: 113 /* 114 * Determine the physical size of the file. 115 */ 116 vattr.va_mask = AT_SIZE; | 58 59 /* 60 * We must have a pathname, and it must be absolute. 61 */ 62 if (vd->vdev_path == NULL || vd->vdev_path[0] != '/') { 63 vd->vdev_stat.vs_aux = VDEV_AUX_BAD_LABEL; 64 return (EINVAL); 65 } --- 43 unchanged lines hidden (view full) --- 109 } 110#endif 111 112skip_open: 113 /* 114 * Determine the physical size of the file. 115 */ 116 vattr.va_mask = AT_SIZE; |
117 vfslocked = VFS_LOCK_GIANT(vp->v_mount); | |
118 vn_lock(vp, LK_SHARED | LK_RETRY); 119 error = VOP_GETATTR(vp, &vattr, kcred); 120 VOP_UNLOCK(vp, 0); | 117 vn_lock(vp, LK_SHARED | LK_RETRY); 118 error = VOP_GETATTR(vp, &vattr, kcred); 119 VOP_UNLOCK(vp, 0); |
121 VFS_UNLOCK_GIANT(vfslocked); | |
122 if (error) { 123 (void) VOP_CLOSE(vp, spa_mode(vd->vdev_spa), 1, 0, kcred, NULL); 124 vd->vdev_stat.vs_aux = VDEV_AUX_OPEN_FAILED; 125 kmem_free(vd->vdev_tsd, sizeof (vdev_file_t)); 126 vd->vdev_tsd = NULL; 127 return (error); 128 } 129 --- 103 unchanged lines hidden --- | 120 if (error) { 121 (void) VOP_CLOSE(vp, spa_mode(vd->vdev_spa), 1, 0, kcred, NULL); 122 vd->vdev_stat.vs_aux = VDEV_AUX_OPEN_FAILED; 123 kmem_free(vd->vdev_tsd, sizeof (vdev_file_t)); 124 vd->vdev_tsd = NULL; 125 return (error); 126 } 127 --- 103 unchanged lines hidden --- |