equal
deleted
inserted
replaced
16 * fields enclosed by brackets "[]" replaced with your own identifying |
16 * fields enclosed by brackets "[]" replaced with your own identifying |
17 * information: Portions Copyright [yyyy] [name of copyright owner] |
17 * information: Portions Copyright [yyyy] [name of copyright owner] |
18 * |
18 * |
19 * CDDL HEADER END |
19 * CDDL HEADER END |
20 */ |
20 */ |
|
21 |
21 /* |
22 /* |
22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. |
23 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. |
23 * Use is subject to license terms. |
24 * Use is subject to license terms. |
24 */ |
25 */ |
25 |
26 |
67 #include <nfs/nfs.h> |
68 #include <nfs/nfs.h> |
68 #include <nfs/nfs_sec.h> |
69 #include <nfs/nfs_sec.h> |
69 #include <rpcsvc/daemon_utils.h> |
70 #include <rpcsvc/daemon_utils.h> |
70 #include <deflt.h> |
71 #include <deflt.h> |
71 #include "../../fslib.h" |
72 #include "../../fslib.h" |
|
73 #include <sharefs/share.h> |
|
74 #include <sharefs/sharetab.h> |
72 #include "../lib/sharetab.h" |
75 #include "../lib/sharetab.h" |
73 #include "mountd.h" |
76 #include "mountd.h" |
74 |
77 |
75 struct sh_list *share_list; |
78 struct sh_list *share_list; |
76 |
79 |
1944 prev_sharetab_time.tv_nsec != last_sharetab_time.tv_nsec) { |
1947 prev_sharetab_time.tv_nsec != last_sharetab_time.tv_nsec) { |
1945 (void) rw_unlock(&sharetab_lock); |
1948 (void) rw_unlock(&sharetab_lock); |
1946 return; |
1949 return; |
1947 } |
1950 } |
1948 |
1951 |
1949 f = fopen(SHARETAB, "r+"); |
1952 /* |
|
1953 * Note that since the sharetab is now in memory |
|
1954 * and a snapshot is taken, we no longer have to |
|
1955 * lock the file. |
|
1956 */ |
|
1957 f = fopen(SHARETAB, "r"); |
1950 if (f == NULL) { |
1958 if (f == NULL) { |
1951 syslog(LOG_ERR, "Cannot open %s: %m", SHARETAB); |
1959 syslog(LOG_ERR, "Cannot open %s: %m", SHARETAB); |
1952 (void) rw_unlock(&sharetab_lock); |
1960 (void) rw_unlock(&sharetab_lock); |
1953 return; |
|
1954 } |
|
1955 |
|
1956 /* |
|
1957 * Lock the file so that unshare can't |
|
1958 * truncate it while we're reading |
|
1959 */ |
|
1960 if (lockf(fileno(f), F_LOCK, 0L) < 0) { |
|
1961 syslog(LOG_ERR, "Cannot lock %s: %m", SHARETAB); |
|
1962 (void) rw_unlock(&sharetab_lock); |
|
1963 (void) fclose(f); |
|
1964 return; |
1961 return; |
1965 } |
1962 } |
1966 |
1963 |
1967 /* |
1964 /* |
1968 * Once we are sure /etc/dfs/sharetab has been |
1965 * Once we are sure /etc/dfs/sharetab has been |