diff options
Diffstat (limited to 'fs/autofs/inode.c')
-rw-r--r-- | fs/autofs/inode.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/fs/autofs/inode.c b/fs/autofs/inode.c index aa0b61ff8270..d8315e61731e 100644 --- a/fs/autofs/inode.c +++ b/fs/autofs/inode.c | |||
@@ -34,12 +34,12 @@ void autofs_kill_sb(struct super_block *sb) | |||
34 | if (!sbi) | 34 | if (!sbi) |
35 | goto out_kill_sb; | 35 | goto out_kill_sb; |
36 | 36 | ||
37 | if ( !sbi->catatonic ) | 37 | if (!sbi->catatonic) |
38 | autofs_catatonic_mode(sbi); /* Free wait queues, close pipe */ | 38 | autofs_catatonic_mode(sbi); /* Free wait queues, close pipe */ |
39 | 39 | ||
40 | autofs_hash_nuke(sbi); | 40 | autofs_hash_nuke(sbi); |
41 | for ( n = 0 ; n < AUTOFS_MAX_SYMLINKS ; n++ ) { | 41 | for (n = 0; n < AUTOFS_MAX_SYMLINKS; n++) { |
42 | if ( test_bit(n, sbi->symlink_bitmap) ) | 42 | if (test_bit(n, sbi->symlink_bitmap)) |
43 | kfree(sbi->symlink[n].data); | 43 | kfree(sbi->symlink[n].data); |
44 | } | 44 | } |
45 | 45 | ||
@@ -69,7 +69,8 @@ static match_table_t autofs_tokens = { | |||
69 | {Opt_err, NULL} | 69 | {Opt_err, NULL} |
70 | }; | 70 | }; |
71 | 71 | ||
72 | static int parse_options(char *options, int *pipefd, uid_t *uid, gid_t *gid, pid_t *pgrp, int *minproto, int *maxproto) | 72 | static int parse_options(char *options, int *pipefd, uid_t *uid, gid_t *gid, |
73 | pid_t *pgrp, int *minproto, int *maxproto) | ||
73 | { | 74 | { |
74 | char *p; | 75 | char *p; |
75 | substring_t args[MAX_OPT_ARGS]; | 76 | substring_t args[MAX_OPT_ARGS]; |
@@ -140,7 +141,7 @@ int autofs_fill_super(struct super_block *s, void *data, int silent) | |||
140 | int minproto, maxproto; | 141 | int minproto, maxproto; |
141 | 142 | ||
142 | sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); | 143 | sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); |
143 | if ( !sbi ) | 144 | if (!sbi) |
144 | goto fail_unlock; | 145 | goto fail_unlock; |
145 | DPRINTK(("autofs: starting up, sbi = %p\n",sbi)); | 146 | DPRINTK(("autofs: starting up, sbi = %p\n",sbi)); |
146 | 147 | ||
@@ -169,14 +170,16 @@ int autofs_fill_super(struct super_block *s, void *data, int silent) | |||
169 | goto fail_iput; | 170 | goto fail_iput; |
170 | 171 | ||
171 | /* Can this call block? - WTF cares? s is locked. */ | 172 | /* Can this call block? - WTF cares? s is locked. */ |
172 | if ( parse_options(data,&pipefd,&root_inode->i_uid,&root_inode->i_gid,&sbi->oz_pgrp,&minproto,&maxproto) ) { | 173 | if (parse_options(data, &pipefd, &root_inode->i_uid, |
174 | &root_inode->i_gid, &sbi->oz_pgrp, &minproto, | ||
175 | &maxproto)) { | ||
173 | printk("autofs: called with bogus options\n"); | 176 | printk("autofs: called with bogus options\n"); |
174 | goto fail_dput; | 177 | goto fail_dput; |
175 | } | 178 | } |
176 | 179 | ||
177 | /* Couldn't this be tested earlier? */ | 180 | /* Couldn't this be tested earlier? */ |
178 | if ( minproto > AUTOFS_PROTO_VERSION || | 181 | if (minproto > AUTOFS_PROTO_VERSION || |
179 | maxproto < AUTOFS_PROTO_VERSION ) { | 182 | maxproto < AUTOFS_PROTO_VERSION) { |
180 | printk("autofs: kernel does not match daemon version\n"); | 183 | printk("autofs: kernel does not match daemon version\n"); |
181 | goto fail_dput; | 184 | goto fail_dput; |
182 | } | 185 | } |
@@ -184,11 +187,11 @@ int autofs_fill_super(struct super_block *s, void *data, int silent) | |||
184 | DPRINTK(("autofs: pipe fd = %d, pgrp = %u\n", pipefd, sbi->oz_pgrp)); | 187 | DPRINTK(("autofs: pipe fd = %d, pgrp = %u\n", pipefd, sbi->oz_pgrp)); |
185 | pipe = fget(pipefd); | 188 | pipe = fget(pipefd); |
186 | 189 | ||
187 | if ( !pipe ) { | 190 | if (!pipe) { |
188 | printk("autofs: could not open pipe file descriptor\n"); | 191 | printk("autofs: could not open pipe file descriptor\n"); |
189 | goto fail_dput; | 192 | goto fail_dput; |
190 | } | 193 | } |
191 | if ( !pipe->f_op || !pipe->f_op->write ) | 194 | if (!pipe->f_op || !pipe->f_op->write) |
192 | goto fail_fput; | 195 | goto fail_fput; |
193 | sbi->pipe = pipe; | 196 | sbi->pipe = pipe; |
194 | sbi->catatonic = 0; | 197 | sbi->catatonic = 0; |
@@ -230,7 +233,7 @@ static void autofs_read_inode(struct inode *inode) | |||
230 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; | 233 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; |
231 | inode->i_blocks = 0; | 234 | inode->i_blocks = 0; |
232 | 235 | ||
233 | if ( ino == AUTOFS_ROOT_INO ) { | 236 | if (ino == AUTOFS_ROOT_INO) { |
234 | inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR; | 237 | inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR; |
235 | inode->i_op = &autofs_root_inode_operations; | 238 | inode->i_op = &autofs_root_inode_operations; |
236 | inode->i_fop = &autofs_root_operations; | 239 | inode->i_fop = &autofs_root_operations; |
@@ -241,12 +244,12 @@ static void autofs_read_inode(struct inode *inode) | |||
241 | inode->i_uid = inode->i_sb->s_root->d_inode->i_uid; | 244 | inode->i_uid = inode->i_sb->s_root->d_inode->i_uid; |
242 | inode->i_gid = inode->i_sb->s_root->d_inode->i_gid; | 245 | inode->i_gid = inode->i_sb->s_root->d_inode->i_gid; |
243 | 246 | ||
244 | if ( ino >= AUTOFS_FIRST_SYMLINK && ino < AUTOFS_FIRST_DIR_INO ) { | 247 | if (ino >= AUTOFS_FIRST_SYMLINK && ino < AUTOFS_FIRST_DIR_INO) { |
245 | /* Symlink inode - should be in symlink list */ | 248 | /* Symlink inode - should be in symlink list */ |
246 | struct autofs_symlink *sl; | 249 | struct autofs_symlink *sl; |
247 | 250 | ||
248 | n = ino - AUTOFS_FIRST_SYMLINK; | 251 | n = ino - AUTOFS_FIRST_SYMLINK; |
249 | if ( n >= AUTOFS_MAX_SYMLINKS || !test_bit(n,sbi->symlink_bitmap)) { | 252 | if (n >= AUTOFS_MAX_SYMLINKS || !test_bit(n,sbi->symlink_bitmap)) { |
250 | printk("autofs: Looking for bad symlink inode %u\n", (unsigned int) ino); | 253 | printk("autofs: Looking for bad symlink inode %u\n", (unsigned int) ino); |
251 | return; | 254 | return; |
252 | } | 255 | } |