Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 300063 Details for
Bug 208103
Anaconda doesn't umount NFS shares before rebooting
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
patch to undomounts.c
undomounts.diff (text/plain), 4.67 KB, created by
Joel Andres Granados
on 2008-04-02 13:39:55 UTC
(
hide
)
Description:
patch to undomounts.c
Filename:
MIME Type:
Creator:
Joel Andres Granados
Created:
2008-04-02 13:39:55 UTC
Size:
4.67 KB
patch
obsolete
>diff --git a/loader2/undomounts.c b/loader2/undomounts.c >index 07892af..0df48be 100644 >--- a/loader2/undomounts.c >+++ b/loader2/undomounts.c >@@ -27,11 +27,13 @@ > #include <sys/stat.h> > #include <sys/swap.h> > #include <unistd.h> >- > #include "devt.h" >+#include "nfsmount.h" > > struct unmountInfo { > char * name; >+ char * fstype; >+ char * device; > int mounted; > int loopDevice; > enum { FS, LOOP } what; >@@ -45,6 +47,89 @@ static void printstr(char * string) { > write(1, string, strlen(string)); > } > >+static int xdr_dir(XDR *xdrsp, char *dirp) >+{ >+ return (xdr_string(xdrsp, &dirp, MNTPATHLEN)); >+} >+ >+static int >+nfs_umount_rpc_call(const char *spec, const char *opts) >+{ >+ register CLIENT *clp; >+ struct sockaddr_in saddr; >+ struct timeval pertry, try; >+ enum clnt_stat clnt_stat; >+ int port = 0; >+ int so = RPC_ANYSOCK; >+ struct hostent *hostp; >+ char *hostname; >+ char *dirname; >+ char *p; >+ char *tmp; >+ >+ if (spec == NULL || (p = strchr(spec,':')) == NULL) >+ return 0; >+ tmp = strdup(spec); >+ hostname = strtok(tmp, ":"); >+ dirname = strtok(NULL, ":"); >+ >+ if (opts && (p = strstr(opts, "addr="))) { >+ char *q; >+ >+ free(hostname); >+ tmp = strdup(p); >+ strtok(tmp, "= ,"); >+ hostname = strtok(NULL, "= ,"); >+ } >+ >+ if (opts && (p = strstr(opts, "mountport=")) && isdigit(*(p+10))) >+ port = atoi(p+10); >+ >+ sleep(5); >+ if (hostname[0] >= '0' && hostname[0] <= '9'){ >+ saddr.sin_addr.s_addr = inet_addr(hostname); >+ } else { >+ if (mygethostbyname(hostname, &saddr.sin_addr) < 0) >+ return 1; >+ } >+ >+ saddr.sin_family = AF_INET; >+ saddr.sin_port = htons(port); >+ pertry.tv_sec = 3; >+ pertry.tv_usec = 0; >+ if (opts && (p = strstr(opts, "tcp"))) { >+ /* possibly: make sure option is not "notcp" >+ possibly: try udp if tcp fails */ >+ if ((clp = clnttcp_create(&saddr, MOUNTPROG, MOUNTVERS, >+ &so, 0, 0)) == NULL) { >+ clnt_pcreateerror("Cannot MOUNTPROG RPC (tcp)"); >+ return 1; >+ } >+ } else { >+ if ((clp = clntudp_create(&saddr, MOUNTPROG, MOUNTVERS, >+ pertry, &so)) == NULL) { >+ clnt_pcreateerror("Cannot MOUNTPROG RPC"); >+ return 1; >+ } >+ } >+ clp->cl_auth = authunix_create_default(); >+ try.tv_sec = 20; >+ try.tv_usec = 0; >+ clnt_stat = clnt_call(clp, MOUNTPROC_UMNT, >+ (xdrproc_t) xdr_dir, dirname, >+ (xdrproc_t) xdr_void, (caddr_t) 0, >+ try); >+ >+ if (clnt_stat != RPC_SUCCESS) { >+ clnt_perror(clp, "Bad UMNT RPC"); >+ return 1; >+ } >+ auth_destroy(clp->cl_auth); >+ clnt_destroy(clp); >+ >+ return 0; >+} >+ > void undoMount(struct unmountInfo * fs, int numFs, int this) { > int len = strlen(fs[this].name); > int i; >@@ -66,12 +151,20 @@ void undoMount(struct unmountInfo * fs, int numFs, int this) { > > printf("\t%s", fs[this].name); > /* don't need to unmount /tmp. it is busy anyway. */ >- if (!testing) { >- if (umount2(fs[this].name, 0) < 0) { >- printf(" umount failed (%d)", errno); >- } else { >- printf(" done"); >- } >+ if (!testing && strncmp (fs[this].name, "/proc", 5) != 0) { >+ sleep(2); >+ if(strcmp(fs[this].fstype, "nfs") == 0){ >+ if(nfs_umount_rpc_call(fs[this].device, "") != 0){ >+ printf(" umount failed (%d)", errno); >+ }else{ >+ printf(" done"); >+ } >+ } else{ >+ if (umount2(fs[this].name, 0) < 0) >+ printf(" umount failed (%d)", errno); >+ else >+ printf(" done"); >+ } > } > printf("\n"); > } >@@ -112,12 +205,11 @@ void undoLoop(struct unmountInfo * fs, int numFs, int this) { > void unmountFilesystems(void) { > int fd, size; > char buf[65535]; /* this should be big enough */ >- char * chptr, * start; >+ char * chptr, * start, * device, * fst; > struct unmountInfo filesystems[500]; > int numFilesystems = 0; > int i; > struct loop_info li; >- char * device; > struct stat sb; > > fd = open("/proc/mounts", O_RDONLY, 0); >@@ -141,11 +233,16 @@ void unmountFilesystems(void) { > start = chptr; > while (*chptr != ' ') chptr++; > *chptr++ = '\0'; >+ fst = chptr; >+ while (*chptr != ' ') chptr++; >+ *chptr++ = '\0'; > > if (strcmp(start, "/") && strcmp(start, "/tmp")) { > filesystems[numFilesystems].name = strdup(start); > filesystems[numFilesystems].what = FS; > filesystems[numFilesystems].mounted = 1; >+ filesystems[numFilesystems].fstype = strdup(fst); >+ filesystems[numFilesystems].device = strdup(device); > > stat(start, &sb); > if ((sb.st_dev >> 8) == 7) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 208103
:
137140
|
137141
|
298724
|
299736
|
300063
|
300064
|
301816