CIFS mount points on the fly.
Mail from Ivana Varekova (varekova@redhat.com) 02/02/2011:
Hello, I'm sending 6 patches - 3 for nfsiostat and 3 for cifsiostat
nfsiostat:
nfsiostat.patch - adds the possibility to extend the number of
slots for nfs mount points during the nfsiostat run
cifsiostat:
cifsiostat.patch - adds the possibility to extend the number of
slots for cifs mount points during the cifsiostat run
See also mail from Masanari Iida (masanari.iida@hp.com) 28/01/2011:
Hello
I have a feedback about nfsiostat behavior.
Description
nfsiostat need to be run _AFTER_ the NFS share is mounted.
Version.
nfsiostat in sysstat 9.1.7
How to reproduce
(1) Run nfsiostat -k 1
(2) Mount one NFS share
(3) Check nfsiostat output.
Expected result.
nfsiostat start to report the NFS share's activities, after I mount it.
Actual result.
nfsiostat not reporting the mounted NFS share, even after it is mounted.
Additional information:
If I mount the NFS share _BEFORE_ i run nfsiostat, nfsiostat reports the
NFS share's information. And also, if I umount the NFS share,
the line disappeared. (This is expected.)
It is because, the environment is using autofs, mount and umount often
happens on the system.
But I continously running the iostat -kn to collect the statics, then I have
encounteded this symptom. (And tested with nfsiostat )
In case of multiple NFS mount points, the symptom is bit different.
If an additional NFS share is mounted BEFORE this test is done,
the target NFS share appeared after mount it. And dissapeared it after umount.
But if I do the same thing one more time, it is not display any more.
========
To say the truth, the original symptom is happen on sysstat 7.0
on RHEL5 system, using iostat -kn. The environment uses autofs.
I wanted to confirm if the upstream version already fixed this symptom,
so that's why I downloaded the latest tar ball and tried.
But so far, the similar symptom still exist.
If you think this is current known limitation or known bug,
please document it in man page or FAQ page of your web.
Regards,
Masanari Iida
xxxx/xx/xx: Version 10.0.0 - Sebastien Godard (sysstat <at> orange.fr)
* [Ivana Varekova]: Fix a problem with long NFS and CIFS share
names in cifsiostat and nfsiostat.
+ * [Ivana Varekova]: Added the possibility to extend the number
+ of slots for NFS and CIFS mount points on the fly.
* [Ivana Varekova]: Check calloc() return value in cifsiostat
and nfsiostat.
* [Jan Kaluza]: Added --debuginfo option to cifsiostat and
*/
void save_stats(char *name, int curr, struct cifs_stats *st_io)
{
- int i;
+ int i, j;
struct io_hdr_stats *st_hdr_cifs_i;
struct cifs_stats *st_cifs_i;
break;
}
}
+ if (i == cifs_nr) {
+ /* All entries are used: The number has to be increased */
+ cifs_nr = cifs_nr + 5;
+
+ /* Increase the size of st_hdr_ionfs buffer */
+ if ((st_hdr_cifs = (struct io_hdr_stats *)
+ realloc(st_hdr_cifs, cifs_nr * IO_HDR_STATS_SIZE)) == NULL) {
+ perror("malloc");
+ exit(4);
+ }
+
+ /* Set the new entries inactive */
+ for (j = 0; j < 5; j++) {
+ st_hdr_cifs_i = st_hdr_cifs + j;
+ st_hdr_cifs_i->used = FALSE;
+ }
+
+ /* Increase the size of st_hdr_ionfs buffer */
+ for (j = 0; j < 2; j++) {
+ if ((st_cifs[j] = (struct cifs_stats *)
+ realloc(st_cifs[j], cifs_nr * CIFS_STATS_SIZE)) == NULL) {
+ perror("malloc");
+ exit(4);
+ }
+ }
+
+ /* Now i shows the first unused entry of the new block */
+ st_hdr_cifs_i = st_hdr_cifs + i;
+ st_hdr_cifs_i->used = TRUE; /* Indicate it is now used */
+ strcpy(st_hdr_cifs_i->name, name);
+ st_cifs_i = st_cifs[!curr] + i;
+ memset(st_cifs_i, 0, CIFS_STATS_SIZE);
+ }
}
if (i < cifs_nr) {
st_hdr_cifs_i = st_hdr_cifs + i;
void save_stats(char *name, int curr, void *st_io, int ionfs_nr,
struct io_hdr_stats *st_hdr_ionfs)
{
- int i;
+ int i, j;
struct io_hdr_stats *st_hdr_ionfs_i;
struct io_nfs_stats *st_ionfs_i;
break;
}
}
+ if (i == ionfs_nr) {
+ /* All entries are used: The number has to be increased */
+ ionfs_nr = ionfs_nr + 5;
+
+ /* Increase the size of st_hdr_ionfs buffer */
+ if ((st_hdr_ionfs = (struct io_hdr_stats *)
+ realloc(st_hdr_ionfs, ionfs_nr * IO_HDR_STATS_SIZE)) == NULL) {
+ perror("malloc");
+ exit(4);
+ }
+
+ /* Set the new entries inactive */
+ for (j = 0; j < 5; j++) {
+ st_hdr_ionfs_i = st_hdr_ionfs + j;
+ st_hdr_ionfs_i->used = FALSE;
+ }
+
+ /* Increase the size of st_hdr_ionfs buffer */
+ for (j = 0; j < 2; j++) {
+ if ((st_ionfs[j] = (struct io_nfs_stats *)
+ realloc(st_ionfs[j], ionfs_nr * IO_NFS_STATS_SIZE)) == NULL) {
+ perror("malloc");
+ exit(4);
+ }
+ }
+
+ /* Now i shows the first unused entry of the new block */
+ st_hdr_ionfs_i = st_hdr_ionfs + i;
+ st_hdr_ionfs_i->used = TRUE; /* Indicate it is now used */
+ strcpy(st_hdr_ionfs_i->name, name);
+ st_ionfs_i = st_ionfs[!curr] + i;
+ memset(st_ionfs_i, 0, IO_NFS_STATS_SIZE);
+ }
}
if (i < ionfs_nr) {
st_hdr_ionfs_i = st_hdr_ionfs + i;