aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/fib_semantics.c
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2006-08-30 02:10:47 -0400
committerPaul Mackerras <paulus@samba.org>2006-08-30 02:10:47 -0400
commit467c37801c453849a2fe243c3226476ee3985868 (patch)
treeb1e9dedf59ff9144945cb711a96274f4ca9bce62 /net/ipv4/fib_semantics.c
parente0d872d536bb93335d5905b09fe374a163486d43 (diff)
[POWERPC] Fix irq enable/disable in smp_generic_take_timebase
Eran Ben-Avi <eranpublic@yahoo.com> pointed out that the arch/ppc version of smp_generic_take_timebase disables interrupts on entry but exits without restoring them. However, both it and the arch/powerpc version have another problem, which is that they use local_irq_disable/enable rather than local_irq_save/restore, and they are called with interrupts disabled. This fixes both problems; it changes a return to a break in the arch/ppc version, and changes both versions to use local_irq_save/restore. Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'net/ipv4/fib_semantics.c')
0 files changed, 0 insertions, 0 deletions
gt; 2005-04-16 18:20:36 -0400 committer Linus Torvalds <torvalds@ppc970.osdl.org> 2005-04-16 18:20:36 -0400 Linux-2.6.12-rc2' href='/cgit/cgit.cgi/litmus-rt-ext-res.git/commit/fs/cifs/cifsfs.c?id=1da177e4c3f41524e886b7f1b8a0c1fc7321cac2'>1da177e4c3f4
ee9b6d61a2a4
1da177e4c3f4
cb978ac8b85f
11911b956f35

63135e088a60
1da177e4c3f4
cb978ac8b85f
63135e088a60

1da177e4c3f4
cb978ac8b85f
63135e088a60

1da177e4c3f4
60654ce047f7
11911b956f35

10b9b98e41ba
e75047344ea4
60654ce047f7
e75047344ea4
f92a720ee9d5








1da177e4c3f4



da472fc847e9
3998e6b87d42
3d22462ae915
da472fc847e9
24261fc23db9























1da177e4c3f4
97d1152acec0
1da177e4c3f4

b2e5cd33b598
2f6c94796337
1da177e4c3f4
50c2f7538872
b2e5cd33b598
2f6c94796337
1da177e4c3f4
2c6292ae4be0
1751e8a6cb93
2c6292ae4be0
8a69e96e610b


2f6c94796337
2c6292ae4be0






1da177e4c3f4

a9ae008f407b
851ea0860986





1da177e4c3f4

9b6763e0aacf
1da177e4c3f4
ce634ab28e7d

1da177e4c3f4


2f6c94796337
66ffd113f5d8



48fde701aff6
1da177e4c3f4



50c2f7538872
f3a6a60e4c3a
7521a3c566dd
f96637be0811
7521a3c566dd

f3a6a60e4c3a
1da177e4c3f4



f96637be0811
1da177e4c3f4


6d6861757dfa



98ab494dd1d2
1da177e4c3f4


726c33422318
1da177e4c3f4
726c33422318
39da9847113a
96daf2b09178
76ec5e33846d
6d5786a34d98
76ec5e33846d
1da177e4c3f4
6d5786a34d98
1da177e4c3f4
21ba3845b59c









1da177e4c3f4


76ec5e33846d

39da9847113a
6d5786a34d98
39da9847113a
1da177e4c3f4

31742c5a3317

7119e220a7ae
31742c5a3317








10556cb21a0d
1da177e4c3f4




f696a3659fc4





50c2f7538872
1da177e4c3f4
50c2f7538872
2830ba7f34eb
1da177e4c3f4

e18b890bb088


e18b890bb088
1da177e4c3f4







e94b1766097d
1da177e4c3f4


1da177e4c3f4
b8c32dbb0deb



c67236281c5d
aff8d5ca7a3d
c11f1df5003d

1da177e4c3f4
fbec9ab952d4
20054bd65703

42873b0a282a
fa70b87cc664
2a38e12053b7
b8c32dbb0deb




1da177e4c3f4
f45d34167c67
1da177e4c3f4


fa0d7e3de6d6


fa0d7e3de6d6


1da177e4c3f4


fa0d7e3de6d6
1da177e4c3f4

61f98ffd7425
b57922d97fd6
9451a9a52f91
91b0abe36a7b
dbd5768f87ff
9451a9a52f91



61f98ffd7425

a9f1b85e5ba8


571d597206a9
61f98ffd7425
a9f1b85e5ba8
61f98ffd7425
a9f1b85e5ba8
61f98ffd7425

a9f1b85e5ba8


61f98ffd7425

571d597206a9
61f98ffd7425
8339dd32fbad

61f98ffd7425

3e715513643f
28e11bd86d63
3e715513643f
eda2116f4ab6


28e11bd86d63
eda2116f4ab6
28e11bd86d63
571d597206a9
3e715513643f
28e11bd86d63
3e715513643f
571d597206a9
3e715513643f

571d597206a9
3e715513643f

571d597206a9
3e715513643f

571d597206a9
3e715513643f

571d597206a9
3e715513643f


571d597206a9
3e715513643f


28e11bd86d63
571d597206a9
3e715513643f

d06b5056ae16


571d597206a9
d06b5056ae16

571d597206a9
d06b5056ae16
571d597206a9
d06b5056ae16
571d597206a9
d06b5056ae16

3ae35cde67c1











1da177e4c3f4





34c80b1d93e6
1da177e4c3f4
34c80b1d93e6
96daf2b09178
3eb9a8893a76

8616e0fc1e27
a068acf2ee77
28e11bd86d63
d06b5056ae16
3e715513643f
29e07c82a9e8
571d597206a9
8727c8a85f39
a068acf2ee77
29e07c82a9e8
e55954a5f7ce
a068acf2ee77
8616e0fc1e27
3eb9a8893a76















1f68233c52e9

340481a36498
571d597206a9
4486d6ede16b
571d597206a9
340481a36498
1f68233c52e9

340481a36498
571d597206a9
4486d6ede16b
571d597206a9
8616e0fc1e27
61f98ffd7425
1da177e4c3f4
8616e0fc1e27
5206efd62ce4
2b280fab12b6

3ae35cde67c1


8616e0fc1e27
571d597206a9
8616e0fc1e27
571d597206a9
8616e0fc1e27
571d597206a9
6e82e929d985

f16dfa7cd1b5

592fafe644bf

b326614ea215





8616e0fc1e27
571d597206a9
8616e0fc1e27
571d597206a9
9593265531fa

8616e0fc1e27
571d597206a9
d4ffff1fa969
571d597206a9
d4ffff1fa969
571d597206a9
8616e0fc1e27
571d597206a9
8616e0fc1e27
571d597206a9
bc8ebdc4f54c

8616e0fc1e27
571d597206a9
8616e0fc1e27
571d597206a9
3d4ef9a15343

8616e0fc1e27
571d597206a9
8616e0fc1e27
571d597206a9
1751e8a6cb93
571d597206a9
736a33205969
571d597206a9
476428f8c3bb
571d597206a9
71c424bac567
571d597206a9
71c424bac567
571d597206a9
3c7c87fd5bd7
1f68233c52e9


3c7c87fd5bd7
1f68233c52e9


8616e0fc1e27
28f8881023c9

adfeb3e00e8e

8a69e96e610b

6d20e8406f09
156d17905e78
8616e0fc1e27
1da177e4c3f4


42faad99658e
68058e757573
42faad99658e
96daf2b09178
68058e757573
4523cc3044d1
9e2e85f82fa2

0d424ad0a4b8
f1987b44f642
3f9bcca7820a
ad8034f19792



3f9bcca7820a
ad8034f19792

5e1253b50111
3f9bcca7820a
5e1253b50111
3a5ff61c1865
7b7abfe3dd81
50c2f7538872
f96637be0811
9e2e85f82fa2
6ab16d249513




5e1253b50111
68058e757573


68058e757573
bf97d28711e2
64132379d509
bf97d28711e2





1da177e4c3f4

02b9984d6408
1751e8a6cb93
1da177e4c3f4


45321ac54316
12420ac34153


45321ac54316


12420ac34153

ee9b6d61a2a4
1da177e4c3f4


12420ac34153
b57922d97fd6
12420ac34153

50c2f7538872

1da177e4c3f4
7b7abfe3dd81
1da177e4c3f4
bf97d28711e2
f46d3e11903e
bf97d28711e2
1da177e4c3f4

f87d39d95132






fec11dd9a010
f87d39d95132
fec11dd9a010

f87d39d95132

348c1bfa84df


6d3ea7e4975a
374402a2a1df
f87d39d95132
9403c9c598e9
f87d39d95132
f96637be0811
f87d39d95132
f87d39d95132
fec11dd9a010



2b0143b5c986
fec11dd9a010

5b980b012121




ce2ac52105aa




5b980b012121
fec11dd9a010









85f40482bc17
fec11dd9a010


f87d39d95132
fec11dd9a010
f87d39d95132

ee01a14d9ddc






d753ed975953
c7c137b931b6

1da177e4c3f4

db71922217a2
724d9f1cfba0

25c7f41e9234
724d9f1cfba0
1da177e4c3f4
f96637be0811
1da177e4c3f4
c7c137b931b6
04db79b015da

724d9f1cfba0



5c4f1ad7c6aa
724d9f1cfba0

5d3bc605cafe


4214ebf46547
5d3bc605cafe

4214ebf46547



a6b5058fafdf

97d1152acec0

1751e8a6cb93
f96637be0811

97d1152acec0
4214ebf46547
97d1152acec0

25c7f41e9234



9249e17fe094
1751e8a6cb93
9249e17fe094

724d9f1cfba0
724d9f1cfba0
97d1152acec0
d757d71bfc30
724d9f1cfba0
1da177e4c3f4
ee01a14d9ddc
f96637be0811
97d1152acec0
5c4f1ad7c6aa
5c4f1ad7c6aa




b2e5cd33b598
1751e8a6cb93
1da177e4c3f4
724d9f1cfba0
348c1bfa84df
9403c9c598e9
f87d39d95132
25c7f41e9234
f96637be0811
641a58d66d08
724d9f1cfba0
641a58d66d08
641a58d66d08
641a58d66d08
f9e59bcba2cf
724d9f1cfba0
5c4f1ad7c6aa
4214ebf46547

5c4f1ad7c6aa
5c4f1ad7c6aa



1da177e4c3f4

c7c137b931b6













08bc03539d38





882137c4d641


08bc03539d38






3dae8750c368
1da177e4c3f4
496ad9aa8ef4
c11f1df5003d
1da177e4c3f4
72432ffcf555
1da177e4c3f4
882137c4d641











c11f1df5003d



3dae8750c368
72432ffcf555
18cceb6a78f4
c11f1df5003d
72432ffcf555


3dae8750c368
f96637be0811
72432ffcf555
c11f1df5003d

1da177e4c3f4


965c8e59cfcf
c32a0b689cb9
06222e491e66
965c8e59cfcf
06222e491e66

965c8e59cfcf
6feb9891da4f
496ad9aa8ef4
6feb9891da4f




18cceb6a78f4
6feb9891da4f

156ecb2d8b06



6feb9891da4f










c32a0b689cb9
965c8e59cfcf
c32a0b689cb9

e6f5c78930e4

84210e9120a8
18cceb6a78f4



496ad9aa8ef4
ba00ba64cf08
84210e9120a8



024408062b21


18cceb6a78f4
e6f5c78930e4
13cfb7334eb6
18cceb6a78f4








e6f5c78930e4
51ee4b84f5c8
84210e9120a8

84210e9120a8
e6ab15827eec
1da177e4c3f4

d753ed975953
6d6861757dfa
1da177e4c3f4

3e64fe5b2185
49218b4f5745



c7c137b931b6
49218b4f5745





754661f143e7
1da177e4c3f4
d2c127197dfc
1da177e4c3f4





2773bf00aeb9
1da177e4c3f4
1da177e4c3f4


1da177e4c3f4
1da177e4c3f4

754661f143e7
1da177e4c3f4
48a77aa7e205
1da177e4c3f4
1da177e4c3f4
1da177e4c3f4

754661f143e7
6b2553918d8b
1da177e4c3f4
1da177e4c3f4
1da177e4c3f4

04b38d601239






04b38d601239


























09cbfeaf1a5a
04b38d601239









04b38d601239







620d8745b35d


































































6e70c267e68d











620d8745b35d












4b6f5d20b04d
08bc03539d38
3dae8750c368
1da177e4c3f4





5ffc4ef45b3b
cd1aca29fa02
c32a0b689cb9
f9ddcca4cf7d
620d8745b35d
04b38d601239
84210e9120a8
31742c5a3317
1da177e4c3f4

8be7e6ba1424
e6a7bcb4c489
3dae8750c368
8be7e6ba1424




7a6a19b17ab9
8be7e6ba1424
cd1aca29fa02
8be7e6ba1424
8be7e6ba1424
620d8745b35d
04b38d601239
8be7e6ba1424
31742c5a3317
8be7e6ba1424

4b6f5d20b04d
0b81c1c405c0
e6a7bcb4c489
3dae8750c368
1da177e4c3f4




a994b8fa669f
5ffc4ef45b3b
cd1aca29fa02
f9ddcca4cf7d
620d8745b35d
04b38d601239
c32a0b689cb9
84210e9120a8
31742c5a3317
1da177e4c3f4
8be7e6ba1424
4b6f5d20b04d
08bc03539d38
3dae8750c368
87c89dd73307




5ffc4ef45b3b
cd1aca29fa02
c32a0b689cb9
f9ddcca4cf7d
620d8745b35d
04b38d601239
84210e9120a8
31742c5a3317
8b94bcb923df

8be7e6ba1424
e6a7bcb4c489
3dae8750c368
8be7e6ba1424



7a6a19b17ab9
8be7e6ba1424
cd1aca29fa02
8be7e6ba1424
8be7e6ba1424
620d8745b35d
04b38d601239
8be7e6ba1424
31742c5a3317
8be7e6ba1424

4b6f5d20b04d
0b81c1c405c0
e6a7bcb4c489
3dae8750c368
87c89dd73307



810627a01316
5ffc4ef45b3b
cd1aca29fa02
f9ddcca4cf7d
620d8745b35d
04b38d601239
c32a0b689cb9
84210e9120a8
31742c5a3317
8b94bcb923df
1da177e4c3f4
4b6f5d20b04d
3125d2650cae
1da177e4c3f4

f9ddcca4cf7d
620d8745b35d
04b38d601239
3222a3e55f40
6e70c267e68d
1da177e4c3f4


51cc50685a42
1da177e4c3f4


a35afb830f8d
1b4b55a1d940
1da177e4c3f4

9ee108b2c626
1da177e4c3f4


26f57364d7cd
fffb60f93ce5
5d097056c9a0
20c2df83d25c
1da177e4c3f4








8c0a85377048




1a1d92c10dd2
1da177e4c3f4




3792c1732878



2a38e12053b7

4523cc3044d1
1da177e4c3f4







f96637be0811



de046449045a
3792c1732878
de046449045a


1da177e4c3f4


4523cc3044d1
1da177e4c3f4


f96637be0811
1da177e4c3f4

93d2341c750c

1da177e4c3f4
4523cc3044d1
1da177e4c3f4


ec637e3ffb6b
1da177e4c3f4

50c2f7538872
1da177e4c3f4

6dc0f87e3511
1da177e4c3f4
de046449045a
6dc0f87e3511
de046449045a
1da177e4c3f4


6dc0f87e3511
1da177e4c3f4

4523cc3044d1
1da177e4c3f4


f96637be0811
1da177e4c3f4

93d2341c750c

1da177e4c3f4
4523cc3044d1
1da177e4c3f4












1a1d92c10dd2
1da177e4c3f4
1a1d92c10dd2
1da177e4c3f4





26f57364d7cd

1da177e4c3f4


93d2341c750c

4523cc3044d1
1da177e4c3f4



1da177e4c3f4






1a1d92c10dd2
1da177e4c3f4

1da177e4c3f4



1da177e4c3f4
e7ddee9037e7
0eff0e267774
4ca9c190d902

0eff0e267774
1da177e4c3f4




6dc0f87e3511
1da177e4c3f4



4498eed50a11





1da177e4c3f4



3f9bcca7820a
1da177e4c3f4

51b0817b0d23
3d22462ae915
4523cc3044d1
1da177e4c3f4
f96637be0811
10b9b98e41ba

f96637be0811

1da177e4c3f4

da472fc847e9





3998e6b87d42






f579cf3cfd1e

3998e6b87d42
f579cf3cfd1e
1da177e4c3f4
45af7a0f2eba
d3bf5221d327
45af7a0f2eba








84a15b935481
b74cb9a80268
84a15b935481
4d79dba0e007





c4aca0c09f80
4d79dba0e007



c4aca0c09f80
45af7a0f2eba
49218b4f5745





45af7a0f2eba

c4aca0c09f80
4d79dba0e007

c4aca0c09f80
4d79dba0e007
84a15b935481
b74cb9a80268
c4aca0c09f80
1fc7995d1913
45af7a0f2eba
d3bf5221d327
45af7a0f2eba
d3bf5221d327
45af7a0f2eba
d3bf5221d327
f579cf3cfd1e
3998e6b87d42


da472fc847e9
d3bf5221d327

1da177e4c3f4





49218b4f5745
3dd933061d3a
49218b4f5745
78d31a3a87f8
4d79dba0e007
4d79dba0e007

84a15b935481
94183331e815
84a15b935481
1da177e4c3f4
3dd933061d3a


3998e6b87d42
da472fc847e9
3dd933061d3a
1da177e4c3f4


6dc0f87e3511
1da177e4c3f4
63135e088a60

1da177e4c3f4
b9be76d585d4






b9be76d585d4


5fcd7f3f966f
026e93dc0a3e

1da177e4c3f4

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561


                     
                                                                    





























                                                                             
                        
                          
                          
                        
                         
                       
                        
                     







                            
                           
                        
                    
                    
 
                
              
                           

                               
                                                    
                                           
                                      
                                
                                                    
                                               
                                         

                                                                              
                                                                         
                                              
                                       

                                                                            
                                 
                                         

                                                                              
                                             
                                           

                                                                         
                                                                        
                                         
                                                                              
 








                                                                                



                                    
                                    
                                        
                       
 























                                                                               
          
                                       

                            
                                     
                               
                   
 
                              
                                            
 
                                                          
                                           
 


                                         
                                                                               






                                                                     

                                        
                                          





                                                         

                                                                              
                                   
 

                                    


                                 
                         



                                                 
                                        



                                 
 
                              
                                                               
                                                        

                                                   
                                    



                 
                                                               


                  



                                                   
                             


          
                                                       
 
                                              
                                                   
                                                              
                                                           
                         
                   
 
                        
 









                                                                                


                                               

                                                          
 
                      
                 

 

                                                                               
                                                          








                                                                          
                                                         




                                       





                                                                    
                                                                   
                                                                           
                                                                    
                                                       

 


                                            
                                             







                                         
                                                                     


                                                     
                             



                                                                              
                                             
                              

                                                  
                                                                             
                                   

                                   
                              
                                                    
 




                                                                              
                                                  
                                           


                                      


                                                                      


                                                          


                                       
                                                 

 
           
                                     
 
                                                   
                           



                                                 

                                                                     


                                                                            
                              
 
                                            
                     
                                                            

                      


                                                                  

                      
                                         
         

                                     

 
           
                                                            
 


                                                 
                       
         
 
                             
 
                               
                    
                                      

                      
                                      

                      
                                    

                      
                                    

                        
                                       


                                           
                                       


                      
                      
                                 

 


                                                                        
                               

                                                           
                                      
                                                                
                                    
            
                                     

 











                                                                   





                                                                       
                                                          
 
                                                           
                                                              

                                                                 
 
                                                                            
                                         
                                           
 
                                                           
                                          
                                      
                                                                     
 
                                                                   
                                                                    
 















                                                              

                                                                      
                                                           
                                         
            
                                           
 

                                                                      
                                                           
                                         
            
                                           
 
                                                
 
                            
                                                              

                                                                  


                                             
                       
                                     
                         
                                       
                        
                                     

                                     

                                                  

                                                 





                                       
                                                             
                                           
                                                         
                                        

                                                              
                                                             
                                          
                                                              
                                             
                                                            
                                          
                                                          
                                             
                                                                 
                                         

                                                             
                                                          
                                    
                                                        
                                      

                                                                 
                                                          
                                        
                                                         
                                        
                                              
                                    
                                                             
                                           
                                                         
                                    
                                                         
                                             
                                                         
                                       
                                                                


                                                                     
                                                                


                                                                     
 

                                                   

                                                               

                                                                     
                                                       
                                                             
 


                 
                                                     
 
                                                   
                               
 
                            

                       
                                            
 
                                      



                                                                       
                                                

                                       
                                              
                                        
 
                                                                              
                                           
                                             
                                                                                 
                                                           




                                                            
         


               
 
                         
                                                                   





                      

                                                                       
                            
                                


                 
                                               


                                                            


                                                                     

 
                                                       


                                            
                                          
                                           

                                                                       

                                                                           
                                          
                                            
                                   
                         
                                      
      

  






                                                                         
                              
                                                   

                               

                 


                                                                 
                                                         
                                                                 
                              
                                        
 
                                                             
 
                                    



                                  
                                                    

                                     




                                                  




                                                   
 









                                       
                                                                  


                                  
                         
                      

 






                                                             
                      

                                                                        

               
                               

                                     
                                      
                            
 
                                                                  
 
                                                                            

                                             



                                                                   
                             

         


                                                                   
                              

         



                                                      

         

                                              
                                         

                                                                               
                                   
                              

         



                                   
                                                              
                                            

                                                                               
                         
                                    
                                     
                         
         
 
                         
                                                           
                                     
                




                                           
 
                                         
         
 
                                              
                         
                               
 
                                                    
                 
 
          
                                    
    
                                              
                    
 

                                
                                  



                                           

 













                                                                         





                                                               


                                                   






                                                  
                                                                              
 
                                                        
                                                     
                        
               
 











                                                                                        



                                          
                                                      
 
                                            
                         


                                                  
                                                                          
                                    
 

                                


                       
                                                                       
 
          
                                                                             

                                 
                                                       
                       
                                                       




                                                                              
                                                                          

                                                                 



                                                                        










                                                                             
         
                                                         

 

                                                                                 
 



                                                                       
                                               
                                                        



                                      


                                                                        
                                                                  
                                                                
                                                         








                                                                               
                                                                
            

                               
 
                                        

                             
                               
                                

                        
                        



                                               
                               





                                
                                                    
                              
                                        





                                
                               
                                      


                                
                                    

  
                                                     
                                
                                
                                      
                                    

  
                                                        
                                  
                                      
                                    

  






                                                                      


























                                                                               
                                                                









                                                                          







                                                                             


































































                                                                                











                                                                                    












                                                                             
                                              
                                          
                                           





                                
                                                
                                               
                              
                                     
                                                
                                                  
                                  
                                    

  
                                                     
                                       
                                         




                                   
                                      
                                                
                                               
                              
                                     
                                                
                                                  
                                  
                                    

  
                                                     
                                                                            
                                     
                                       




                              
                               
                                                
                                               
                                      
                                                
                                                  
                              
                                  
                                    
  
 
                                                    
                                          
                                           




                                
                                                
                                               
                              
                                     
                                                
                                                  
                                  
                                    

  
                                                           
                                       
                                         



                                   
                                      
                                                
                                               
                              
                                     
                                                
                                                  
                                  
                                    

  
                                                           
                                                                            
                                     
                                       



                              
                               
                                                
                                               
                                      
                                                
                                                  
                              
                                  
                                    
  
 
                                             
                                       

                                    
                                      
                                                
                                                  
                                      
                                


           
                           


                                            
                                           
                                     

 
                 


                                                                 
                                                                           
                                                                       
                                                                              
                                                              








                                      




                                                                      
                                              




                            



                                                                            

                                                
                                    







                                                                                



                                                 
                                                                    
                                                                             


                                                                          


                                    
                             


                                     
                                                                    

         

                                                                   
 
                                     


                                                    
                                                                                

                                                                           
                                                                           

                                                                       
                                                                          
                                                                     
                                                                        
                                                                          
                                                             


                                                    
                               

         
                               


                                        
                                                                       

         

                                                                         
 
                                        












                                                       
                                            
                                           
                                               





                                                           

                                                                          


                                    

                                                                         
                                     



                                                    






                                        
                                            

 



                   
                         
                                           
                                                                

                                              
                                                                                




                                           
                                         



                                               





                                           



                                 
                                           

                                        
                                            
 
                                   
                                     
                                                                    

                                                     

                                                                    

         





                                                                                






                                                                         

                                     
                                                
 
                                    
               
                                       








                                            
                         
                                
               





                                              
                                           



                                                
                                         
 





                                                     

                 
                    

                          
                      
      
                         
                           
                         
      
                                    
                 
                            
                       
                                  
                  
                                  


                                          
                                      

                          





                  
                                       
                                             
                                             
                                           
                      

                          
                         
                           
      
                                    


                                  
                                          
                                      
                          


                                                   
                                                                             
                  

                                                                        
                             






                            


                              
                              

                             

                      
/*
 *   fs/cifs/cifsfs.c
 *
 *   Copyright (C) International Business Machines  Corp., 2002,2008
 *   Author(s): Steve French (sfrench@us.ibm.com)
 *
 *   Common Internet FileSystem (CIFS) client
 *
 *   This library is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU Lesser General Public License as published
 *   by the Free Software Foundation; either version 2.1 of the License, or
 *   (at your option) any later version.
 *
 *   This library is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
 *   the GNU Lesser General Public License for more details.
 *
 *   You should have received a copy of the GNU Lesser General Public License
 *   along with this library; if not, write to the Free Software
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */

/* Note that BB means BUGBUG (ie something to fix eventually) */

#include <linux/module.h>
#include <linux/fs.h>
#include <linux/mount.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/list.h>
#include <linux/seq_file.h>
#include <linux/vfs.h>
#include <linux/mempool.h>
#include <linux/delay.h>
#include <linux/kthread.h>
#include <linux/freezer.h>
#include <linux/namei.h>
#include <linux/random.h>
#include <linux/uuid.h>
#include <linux/xattr.h>
#include <net/ipv6.h>
#include "cifsfs.h"
#include "cifspdu.h"
#define DECLARE_GLOBALS_HERE
#include "cifsglob.h"
#include "cifsproto.h"
#include "cifs_debug.h"
#include "cifs_fs_sb.h"
#include <linux/mm.h>
#include <linux/key-type.h>
#include "cifs_spnego.h"
#include "fscache.h"
#include "smb2pdu.h"

int cifsFYI = 0;
bool traceSMB;
bool enable_oplocks = true;
bool linuxExtEnabled = true;
bool lookupCacheEnabled = true;
bool disable_legacy_dialects; /* false by default */
unsigned int global_secflags = CIFSSEC_DEF;
/* unsigned int ntlmv2_support = 0; */
unsigned int sign_CIFS_PDUs = 1;
static const struct super_operations cifs_super_ops;
unsigned int CIFSMaxBufSize = CIFS_MAX_MSGSIZE;
module_param(CIFSMaxBufSize, uint, 0444);
MODULE_PARM_DESC(CIFSMaxBufSize, "Network buffer size (not including header) "
				 "for CIFS requests. "
				 "Default: 16384 Range: 8192 to 130048");
unsigned int cifs_min_rcv = CIFS_MIN_RCV_POOL;
module_param(cifs_min_rcv, uint, 0444);
MODULE_PARM_DESC(cifs_min_rcv, "Network buffers in pool. Default: 4 Range: "
				"1 to 64");
unsigned int cifs_min_small = 30;
module_param(cifs_min_small, uint, 0444);
MODULE_PARM_DESC(cifs_min_small, "Small network buffers in pool. Default: 30 "
				 "Range: 2 to 256");
unsigned int cifs_max_pending = CIFS_MAX_REQ;
module_param(cifs_max_pending, uint, 0444);
MODULE_PARM_DESC(cifs_max_pending, "Simultaneous requests to server for "
				   "CIFS/SMB1 dialect (N/A for SMB3) "
				   "Default: 32767 Range: 2 to 32767.");
module_param(enable_oplocks, bool, 0644);
MODULE_PARM_DESC(enable_oplocks, "Enable or disable oplocks. Default: y/Y/1");

module_param(disable_legacy_dialects, bool, 0644);
MODULE_PARM_DESC(disable_legacy_dialects, "To improve security it may be "
				  "helpful to restrict the ability to "
				  "override the default dialects (SMB2.1, "
				  "SMB3 and SMB3.02) on mount with old "
				  "dialects (CIFS/SMB1 and SMB2) since "
				  "vers=1.0 (CIFS/SMB1) and vers=2.0 are weaker"
				  " and less secure. Default: n/N/0");

extern mempool_t *cifs_sm_req_poolp;
extern mempool_t *cifs_req_poolp;
extern mempool_t *cifs_mid_poolp;

struct workqueue_struct	*cifsiod_wq;
struct workqueue_struct	*cifsoplockd_wq;
__u32 cifs_lock_secret;

/*
 * Bumps refcount for cifs super block.
 * Note that it should be only called if a referece to VFS super block is
 * already held, e.g. in open-type syscalls context. Otherwise it can race with
 * atomic_dec_and_test in deactivate_locked_super.
 */
void
cifs_sb_active(struct super_block *sb)
{
	struct cifs_sb_info *server = CIFS_SB(sb);

	if (atomic_inc_return(&server->active) == 1)
		atomic_inc(&sb->s_active);
}

void
cifs_sb_deactive(struct super_block *sb)
{
	struct cifs_sb_info *server = CIFS_SB(sb);

	if (atomic_dec_and_test(&server->active))
		deactivate_super(sb);
}

static int
cifs_read_super(struct super_block *sb)
{
	struct inode *inode;
	struct cifs_sb_info *cifs_sb;
	struct cifs_tcon *tcon;
	int rc = 0;

	cifs_sb = CIFS_SB(sb);
	tcon = cifs_sb_master_tcon(cifs_sb);

	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIXACL)
		sb->s_flags |= SB_POSIXACL;

	if (tcon->snapshot_time)
		sb->s_flags |= SB_RDONLY;

	if (tcon->ses->capabilities & tcon->ses->server->vals->cap_large_files)
		sb->s_maxbytes = MAX_LFS_FILESIZE;
	else
		sb->s_maxbytes = MAX_NON_LFS;

	/* BB FIXME fix time_gran to be larger for LANMAN sessions */
	sb->s_time_gran = 100;

	sb->s_magic = CIFS_MAGIC_NUMBER;
	sb->s_op = &cifs_super_ops;
	sb->s_xattr = cifs_xattr_handlers;
	rc = super_setup_bdi(sb);
	if (rc)
		goto out_no_root;
	/* tune readahead according to rsize */
	sb->s_bdi->ra_pages = cifs_sb->rsize / PAGE_SIZE;

	sb->s_blocksize = CIFS_MAX_MSGSIZE;
	sb->s_blocksize_bits = 14;	/* default 2**14 = CIFS_MAX_MSGSIZE */
	inode = cifs_root_iget(sb);

	if (IS_ERR(inode)) {
		rc = PTR_ERR(inode);
		goto out_no_root;
	}

	if (tcon->nocase)
		sb->s_d_op = &cifs_ci_dentry_ops;
	else
		sb->s_d_op = &cifs_dentry_ops;

	sb->s_root = d_make_root(inode);
	if (!sb->s_root) {
		rc = -ENOMEM;
		goto out_no_root;
	}

#ifdef CONFIG_CIFS_NFSD_EXPORT
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) {
		cifs_dbg(FYI, "export ops supported\n");
		sb->s_export_op = &cifs_export_ops;
	}
#endif /* CONFIG_CIFS_NFSD_EXPORT */

	return 0;

out_no_root:
	cifs_dbg(VFS, "%s: get root inode failed\n", __func__);
	return rc;
}

static void cifs_kill_sb(struct super_block *sb)
{
	struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
	kill_anon_super(sb);
	cifs_umount(cifs_sb);
}

static int
cifs_statfs(struct dentry *dentry, struct kstatfs *buf)
{
	struct super_block *sb = dentry->d_sb;
	struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
	struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb);
	struct TCP_Server_Info *server = tcon->ses->server;
	unsigned int xid;
	int rc = 0;

	xid = get_xid();

	if (le32_to_cpu(tcon->fsAttrInfo.MaxPathNameComponentLength) > 0)
		buf->f_namelen =
		       le32_to_cpu(tcon->fsAttrInfo.MaxPathNameComponentLength);
	else
		buf->f_namelen = PATH_MAX;

	buf->f_fsid.val[0] = tcon->vol_serial_number;
	/* are using part of create time for more randomness, see man statfs */
	buf->f_fsid.val[1] =  (int)le64_to_cpu(tcon->vol_create_time);

	buf->f_files = 0;	/* undefined */
	buf->f_ffree = 0;	/* unlimited */

	if (server->ops->queryfs)
		rc = server->ops->queryfs(xid, tcon, buf);

	free_xid(xid);
	return 0;
}

static long cifs_fallocate(struct file *file, int mode, loff_t off, loff_t len)
{
	struct cifs_sb_info *cifs_sb = CIFS_FILE_SB(file);
	struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb);
	struct TCP_Server_Info *server = tcon->ses->server;

	if (server->ops->fallocate)
		return server->ops->fallocate(file, tcon, mode, off, len);

	return -EOPNOTSUPP;
}

static int cifs_permission(struct inode *inode, int mask)
{
	struct cifs_sb_info *cifs_sb;

	cifs_sb = CIFS_SB(inode->i_sb);

	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM) {
		if ((mask & MAY_EXEC) && !execute_ok(inode))
			return -EACCES;
		else
			return 0;
	} else /* file mode might have been restricted at mount time
		on the client (above and beyond ACL on servers) for
		servers which do not support setting and viewing mode bits,
		so allowing client to check permissions is useful */
		return generic_permission(inode, mask);
}

static struct kmem_cache *cifs_inode_cachep;
static struct kmem_cache *cifs_req_cachep;
static struct kmem_cache *cifs_mid_cachep;
static struct kmem_cache *cifs_sm_req_cachep;
mempool_t *cifs_sm_req_poolp;
mempool_t *cifs_req_poolp;
mempool_t *cifs_mid_poolp;

static struct inode *
cifs_alloc_inode(struct super_block *sb)
{
	struct cifsInodeInfo *cifs_inode;
	cifs_inode = kmem_cache_alloc(cifs_inode_cachep, GFP_KERNEL);
	if (!cifs_inode)
		return NULL;
	cifs_inode->cifsAttrs = 0x20;	/* default */
	cifs_inode->time = 0;
	/*
	 * Until the file is open and we have gotten oplock info back from the
	 * server, can not assume caching of file data or metadata.
	 */
	cifs_set_oplock_level(cifs_inode, 0);
	cifs_inode->flags = 0;
	spin_lock_init(&cifs_inode->writers_lock);
	cifs_inode->writers = 0;
	cifs_inode->vfs_inode.i_blkbits = 14;  /* 2**14 = CIFS_MAX_MSGSIZE */
	cifs_inode->server_eof = 0;
	cifs_inode->uniqueid = 0;
	cifs_inode->createtime = 0;
	cifs_inode->epoch = 0;
	generate_random_uuid(cifs_inode->lease_key);

	/*
	 * Can not set i_flags here - they get immediately overwritten to zero
	 * by the VFS.
	 */
	/* cifs_inode->vfs_inode.i_flags = S_NOATIME | S_NOCMTIME; */
	INIT_LIST_HEAD(&cifs_inode->openFileList);
	INIT_LIST_HEAD(&cifs_inode->llist);
	return &cifs_inode->vfs_inode;
}

static void cifs_i_callback(struct rcu_head *head)
{
	struct inode *inode = container_of(head, struct inode, i_rcu);
	kmem_cache_free(cifs_inode_cachep, CIFS_I(inode));
}

static void
cifs_destroy_inode(struct inode *inode)
{
	call_rcu(&inode->i_rcu, cifs_i_callback);
}

static void
cifs_evict_inode(struct inode *inode)
{
	truncate_inode_pages_final(&inode->i_data);
	clear_inode(inode);
	cifs_fscache_release_inode_cookie(inode);
}

static void
cifs_show_address(struct seq_file *s, struct TCP_Server_Info *server)
{
	struct sockaddr_in *sa = (struct sockaddr_in *) &server->dstaddr;
	struct sockaddr_in6 *sa6 = (struct sockaddr_in6 *) &server->dstaddr;

	seq_puts(s, ",addr=");

	switch (server->dstaddr.ss_family) {
	case AF_INET:
		seq_printf(s, "%pI4", &sa->sin_addr.s_addr);
		break;
	case AF_INET6:
		seq_printf(s, "%pI6", &sa6->sin6_addr.s6_addr);
		if (sa6->sin6_scope_id)
			seq_printf(s, "%%%u", sa6->sin6_scope_id);
		break;
	default:
		seq_puts(s, "(unknown)");
	}
	if (server->rdma)
		seq_puts(s, ",rdma");
}

static void
cifs_show_security(struct seq_file *s, struct cifs_ses *ses)
{
	if (ses->sectype == Unspecified) {
		if (ses->user_name == NULL)
			seq_puts(s, ",sec=none");
		return;
	}

	seq_puts(s, ",sec=");

	switch (ses->sectype) {
	case LANMAN:
		seq_puts(s, "lanman");
		break;
	case NTLMv2:
		seq_puts(s, "ntlmv2");
		break;
	case NTLM:
		seq_puts(s, "ntlm");
		break;
	case Kerberos:
		seq_puts(s, "krb5");
		break;
	case RawNTLMSSP:
		seq_puts(s, "ntlmssp");
		break;
	default:
		/* shouldn't ever happen */
		seq_puts(s, "unknown");
		break;
	}

	if (ses->sign)
		seq_puts(s, "i");
}

static void
cifs_show_cache_flavor(struct seq_file *s, struct cifs_sb_info *cifs_sb)
{
	seq_puts(s, ",cache=");

	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_STRICT_IO)
		seq_puts(s, "strict");
	else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO)
		seq_puts(s, "none");
	else
		seq_puts(s, "loose");
}

static void
cifs_show_nls(struct seq_file *s, struct nls_table *cur)
{
	struct nls_table *def;

	/* Display iocharset= option if it's not default charset */
	def = load_nls_default();
	if (def != cur)
		seq_printf(s, ",iocharset=%s", cur->charset);
	unload_nls(def);
}

/*
 * cifs_show_options() is for displaying mount options in /proc/mounts.
 * Not all settable options are displayed but most of the important
 * ones are.
 */
static int
cifs_show_options(struct seq_file *s, struct dentry *root)
{
	struct cifs_sb_info *cifs_sb = CIFS_SB(root->d_sb);
	struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb);
	struct sockaddr *srcaddr;
	srcaddr = (struct sockaddr *)&tcon->ses->server->srcaddr;

	seq_show_option(s, "vers", tcon->ses->server->vals->version_string);
	cifs_show_security(s, tcon->ses);
	cifs_show_cache_flavor(s, cifs_sb);

	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MULTIUSER)
		seq_puts(s, ",multiuser");
	else if (tcon->ses->user_name)
		seq_show_option(s, "username", tcon->ses->user_name);

	if (tcon->ses->domainName && tcon->ses->domainName[0] != 0)
		seq_show_option(s, "domain", tcon->ses->domainName);

	if (srcaddr->sa_family != AF_UNSPEC) {
		struct sockaddr_in *saddr4;
		struct sockaddr_in6 *saddr6;
		saddr4 = (struct sockaddr_in *)srcaddr;
		saddr6 = (struct sockaddr_in6 *)srcaddr;
		if (srcaddr->sa_family == AF_INET6)
			seq_printf(s, ",srcaddr=%pI6c",
				   &saddr6->sin6_addr);
		else if (srcaddr->sa_family == AF_INET)
			seq_printf(s, ",srcaddr=%pI4",
				   &saddr4->sin_addr.s_addr);
		else
			seq_printf(s, ",srcaddr=BAD-AF:%i",
				   (int)(srcaddr->sa_family));
	}

	seq_printf(s, ",uid=%u",
		   from_kuid_munged(&init_user_ns, cifs_sb->mnt_uid));
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_UID)
		seq_puts(s, ",forceuid");
	else
		seq_puts(s, ",noforceuid");

	seq_printf(s, ",gid=%u",
		   from_kgid_munged(&init_user_ns, cifs_sb->mnt_gid));
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_GID)
		seq_puts(s, ",forcegid");
	else
		seq_puts(s, ",noforcegid");

	cifs_show_address(s, tcon->ses->server);

	if (!tcon->unix_ext)
		seq_printf(s, ",file_mode=0%ho,dir_mode=0%ho",
					   cifs_sb->mnt_file_mode,
					   cifs_sb->mnt_dir_mode);

	cifs_show_nls(s, cifs_sb->local_nls);

	if (tcon->seal)
		seq_puts(s, ",seal");
	if (tcon->nocase)
		seq_puts(s, ",nocase");
	if (tcon->retry)
		seq_puts(s, ",hard");
	else
		seq_puts(s, ",soft");
	if (tcon->use_persistent)
		seq_puts(s, ",persistenthandles");
	else if (tcon->use_resilient)
		seq_puts(s, ",resilienthandles");
	if (tcon->posix_extensions)
		seq_puts(s, ",posix");
	else if (tcon->unix_ext)
		seq_puts(s, ",unix");
	else
		seq_puts(s, ",nounix");
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS)
		seq_puts(s, ",posixpaths");
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID)
		seq_puts(s, ",setuids");
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UID_FROM_ACL)
		seq_puts(s, ",idsfromsid");
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM)
		seq_puts(s, ",serverino");
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_RWPIDFORWARD)
		seq_puts(s, ",rwpidforward");
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOPOSIXBRL)
		seq_puts(s, ",forcemand");
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR)
		seq_puts(s, ",nouser_xattr");
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR)
		seq_puts(s, ",mapchars");
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SFM_CHR)
		seq_puts(s, ",mapposix");
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL)
		seq_puts(s, ",sfu");
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
		seq_puts(s, ",nobrl");
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_HANDLE_CACHE)
		seq_puts(s, ",nohandlecache");
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL)
		seq_puts(s, ",cifsacl");
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DYNPERM)
		seq_puts(s, ",dynperm");
	if (root->d_sb->s_flags & SB_POSIXACL)
		seq_puts(s, ",acl");
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MF_SYMLINKS)
		seq_puts(s, ",mfsymlinks");
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_FSCACHE)
		seq_puts(s, ",fsc");
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOSSYNC)
		seq_puts(s, ",nostrictsync");
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM)
		seq_puts(s, ",noperm");
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_BACKUPUID)
		seq_printf(s, ",backupuid=%u",
			   from_kuid_munged(&init_user_ns,
					    cifs_sb->mnt_backupuid));
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_BACKUPGID)
		seq_printf(s, ",backupgid=%u",
			   from_kgid_munged(&init_user_ns,
					    cifs_sb->mnt_backupgid));

	seq_printf(s, ",rsize=%u", cifs_sb->rsize);
	seq_printf(s, ",wsize=%u", cifs_sb->wsize);
	seq_printf(s, ",echo_interval=%lu",
			tcon->ses->server->echo_interval / HZ);
	if (tcon->snapshot_time)
		seq_printf(s, ",snapshot=%llu", tcon->snapshot_time);
	/* convert actimeo and display it in seconds */
	seq_printf(s, ",actimeo=%lu", cifs_sb->actimeo / HZ);

	return 0;
}

static void cifs_umount_begin(struct super_block *sb)
{
	struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
	struct cifs_tcon *tcon;

	if (cifs_sb == NULL)
		return;

	tcon = cifs_sb_master_tcon(cifs_sb);

	spin_lock(&cifs_tcp_ses_lock);
	if ((tcon->tc_count > 1) || (tcon->tidStatus == CifsExiting)) {
		/* we have other mounts to same share or we have
		   already tried to force umount this and woken up
		   all waiting network requests, nothing to do */
		spin_unlock(&cifs_tcp_ses_lock);
		return;
	} else if (tcon->tc_count == 1)
		tcon->tidStatus = CifsExiting;
	spin_unlock(&cifs_tcp_ses_lock);

	/* cancel_brl_requests(tcon); */ /* BB mark all brl mids as exiting */
	/* cancel_notify_requests(tcon); */
	if (tcon->ses && tcon->ses->server) {
		cifs_dbg(FYI, "wake up tasks now - umount begin not complete\n");
		wake_up_all(&tcon->ses->server->request_q);
		wake_up_all(&tcon->ses->server->response_q);
		msleep(1); /* yield */
		/* we have to kick the requests once more */
		wake_up_all(&tcon->ses->server->response_q);
		msleep(1);
	}

	return;
}

#ifdef CONFIG_CIFS_STATS2
static int cifs_show_stats(struct seq_file *s, struct dentry *root)
{
	/* BB FIXME */
	return 0;
}
#endif

static int cifs_remount(struct super_block *sb, int *flags, char *data)
{
	sync_filesystem(sb);
	*flags |= SB_NODIRATIME;
	return 0;
}

static int cifs_drop_inode(struct inode *inode)
{
	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);

	/* no serverino => unconditional eviction */
	return !(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) ||
		generic_drop_inode(inode);
}

static const struct super_operations cifs_super_ops = {
	.statfs = cifs_statfs,
	.alloc_inode = cifs_alloc_inode,
	.destroy_inode = cifs_destroy_inode,
	.drop_inode	= cifs_drop_inode,
	.evict_inode	= cifs_evict_inode,
/*	.delete_inode	= cifs_delete_inode,  */  /* Do not need above
	function unless later we add lazy close of inodes or unless the
	kernel forgets to call us with the same number of releases (closes)
	as opens */
	.show_options = cifs_show_options,
	.umount_begin   = cifs_umount_begin,
	.remount_fs = cifs_remount,
#ifdef CONFIG_CIFS_STATS2
	.show_stats = cifs_show_stats,
#endif
};

/*
 * Get root dentry from superblock according to prefix path mount option.
 * Return dentry with refcount + 1 on success and NULL otherwise.
 */
static struct dentry *
cifs_get_root(struct smb_vol *vol, struct super_block *sb)
{
	struct dentry *dentry;
	struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
	char *full_path = NULL;
	char *s, *p;
	char sep;

	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH)
		return dget(sb->s_root);

	full_path = cifs_build_path_to_root(vol, cifs_sb,
				cifs_sb_master_tcon(cifs_sb), 0);
	if (full_path == NULL)
		return ERR_PTR(-ENOMEM);

	cifs_dbg(FYI, "Get root dentry for %s\n", full_path);

	sep = CIFS_DIR_SEP(cifs_sb);
	dentry = dget(sb->s_root);
	p = s = full_path;

	do {
		struct inode *dir = d_inode(dentry);
		struct dentry *child;

		if (!dir) {
			dput(dentry);
			dentry = ERR_PTR(-ENOENT);
			break;
		}
		if (!S_ISDIR(dir->i_mode)) {
			dput(dentry);
			dentry = ERR_PTR(-ENOTDIR);
			break;
		}

		/* skip separators */
		while (*s == sep)
			s++;
		if (!*s)
			break;
		p = s++;
		/* next separator */
		while (*s && *s != sep)
			s++;

		child = lookup_one_len_unlocked(p, dentry, s - p);
		dput(dentry);
		dentry = child;
	} while (!IS_ERR(dentry));
	kfree(full_path);
	return dentry;
}

static int cifs_set_super(struct super_block *sb, void *data)
{
	struct cifs_mnt_data *mnt_data = data;
	sb->s_fs_info = mnt_data->cifs_sb;
	return set_anon_super(sb, NULL);
}

static struct dentry *
cifs_smb3_do_mount(struct file_system_type *fs_type,
	      int flags, const char *dev_name, void *data, bool is_smb3)
{
	int rc;
	struct super_block *sb;
	struct cifs_sb_info *cifs_sb;
	struct smb_vol *volume_info;
	struct cifs_mnt_data mnt_data;
	struct dentry *root;

	cifs_dbg(FYI, "Devname: %s flags: %d\n", dev_name, flags);

	volume_info = cifs_get_volume_info((char *)data, dev_name, is_smb3);
	if (IS_ERR(volume_info))
		return ERR_CAST(volume_info);

	cifs_sb = kzalloc(sizeof(struct cifs_sb_info), GFP_KERNEL);
	if (cifs_sb == NULL) {
		root = ERR_PTR(-ENOMEM);
		goto out_nls;
	}

	cifs_sb->mountdata = kstrndup(data, PAGE_SIZE, GFP_KERNEL);
	if (cifs_sb->mountdata == NULL) {
		root = ERR_PTR(-ENOMEM);
		goto out_free;
	}

	rc = cifs_setup_cifs_sb(volume_info, cifs_sb);
	if (rc) {
		root = ERR_PTR(rc);
		goto out_free;
	}